mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-12 21:35:40 +08:00
Add table applications and devices_applications for tracking installed applications per device and total installed application count.
This commit is contained in:
4
migrations/201607110001_applications_down.sql
Normal file
4
migrations/201607110001_applications_down.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS devices_applications;
|
||||
DROP INDEX IF EXISTS idx_application_name;
|
||||
DROP INDEX IF EXISTS idx_application_identifier;
|
||||
DROP TABLE IF EXISTS applications;
|
||||
26
migrations/201607110001_applications_up.sql
Normal file
26
migrations/201607110001_applications_up.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
||||
-- Cant have a unique constraint on name or identifier because it is possible to have multiple versions of the same
|
||||
-- bundle installed.
|
||||
CREATE TABLE IF NOT EXISTS applications (
|
||||
application_uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
name text NOT NULL,
|
||||
identifier text,
|
||||
short_version text,
|
||||
version text,
|
||||
bundle_size integer,
|
||||
dynamic_size integer,
|
||||
is_validated bool,
|
||||
|
||||
install_count integer DEFAULT 1,
|
||||
UNIQUE(name, version)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_application_name ON applications (name);
|
||||
CREATE INDEX IF NOT EXISTS idx_application_identifier ON applications (identifier);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS devices_applications (
|
||||
device_uuid uuid REFERENCES devices(device_uuid) ON DELETE CASCADE,
|
||||
application_uuid uuid REFERENCES applications(application_uuid) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user