legion-data 0.1.0 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +98 -71
- data/.gitignore +0 -1
- data/.rubocop.yml +10 -7
- data/CHANGELOG.md +16 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +100 -0
- data/README.md +13 -11
- data/legion-data.gemspec +22 -10
- data/lib/legion/data.rb +51 -33
- data/lib/legion/data/connection.rb +55 -19
- data/lib/legion/data/migration.rb +7 -20
- data/lib/legion/data/migrations/001_add_schema_columns.rb +1 -1
- data/lib/legion/data/migrations/002_add_users.rb +17 -0
- data/lib/legion/data/migrations/003_add_groups.rb +16 -0
- data/lib/legion/data/migrations/004_add_chains.rb +25 -0
- data/lib/legion/data/migrations/005_add_envs.rb +24 -0
- data/lib/legion/data/migrations/006_add_dcs.rb +24 -0
- data/lib/legion/data/migrations/007_add_nodes.rb +26 -0
- data/lib/legion/data/migrations/008_add_settings.rb +18 -0
- data/lib/legion/data/migrations/009_add_extensions.rb +25 -0
- data/lib/legion/data/migrations/010_add_runners.rb +21 -0
- data/lib/legion/data/migrations/011_add_functions.rb +29 -0
- data/lib/legion/data/migrations/012_add_tasks.rb +28 -0
- data/lib/legion/data/migrations/013_add_task_logs.rb +23 -0
- data/lib/legion/data/migrations/014_add_relationships.rb +27 -0
- data/lib/legion/data/migrations/015_add_default_extensions.rb +24 -0
- data/lib/legion/data/migrations/016_change_task_args.rb +7 -0
- data/lib/legion/data/migrations/017_add_payload_task.rb +7 -0
- data/lib/legion/data/migrations/018_add_migration_column.rb +7 -0
- data/lib/legion/data/model.rb +26 -25
- data/lib/legion/data/models/chain.rb +0 -1
- data/lib/legion/data/models/datacenter.rb +0 -1
- data/lib/legion/data/models/environment.rb +0 -1
- data/lib/legion/data/models/extension.rb +11 -0
- data/lib/legion/data/models/function.rb +5 -4
- data/lib/legion/data/models/group.rb +10 -0
- data/lib/legion/data/models/node.rb +1 -1
- data/lib/legion/data/models/relationship.rb +1 -1
- data/lib/legion/data/models/runner.rb +15 -0
- data/lib/legion/data/models/setting.rb +10 -0
- data/lib/legion/data/models/task.rb +0 -1
- data/lib/legion/data/models/task_log.rb +0 -1
- data/lib/legion/data/models/user.rb +10 -0
- data/lib/legion/data/settings.rb +68 -0
- data/lib/legion/data/version.rb +1 -1
- data/sonar-project.properties +12 -0
- metadata +119 -54
- data/lib/legion/data/connections/base.rb +0 -45
- data/lib/legion/data/connections/jdbc.rb +0 -21
- data/lib/legion/data/connections/mysql.rb +0 -26
- data/lib/legion/data/connections/mysql2.rb +0 -26
- data/lib/legion/data/connections/mysql_base.rb +0 -19
- data/lib/legion/data/migrations/002_add_chains_table.rb +0 -21
- data/lib/legion/data/migrations/003_add_datacenters_table.rb +0 -21
- data/lib/legion/data/migrations/004_add_envs_table.rb +0 -21
- data/lib/legion/data/migrations/005_add_functions_table.rb +0 -25
- data/lib/legion/data/migrations/006_add_namespaces_table.rb +0 -24
- data/lib/legion/data/migrations/007_add_nodes_table.rb +0 -22
- data/lib/legion/data/migrations/008_add_relationships_table.rb +0 -28
- data/lib/legion/data/migrations/009_add_task_logs_table.rb +0 -17
- data/lib/legion/data/migrations/010_add_tasks_table.rb +0 -20
- data/lib/legion/data/migrations/011_add_users_and_groups.rb +0 -28
- data/lib/legion/data/migrations/012_foreign_keys_users_and_groups.rb +0 -42
- data/lib/legion/data/migrations/013_function_foreign_keys.rb +0 -10
- data/lib/legion/data/migrations/014_nodes_foreign_keys.rb +0 -12
- data/lib/legion/data/migrations/015_relationships_foreign_keys.rb +0 -14
- data/lib/legion/data/migrations/016_tasks_foreign_keys.rb +0 -22
- data/lib/legion/data/migrations/017_add_relationship_to_tasks.rb +0 -14
- data/lib/legion/data/models/namespace.rb +0 -12
@@ -1,21 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `chains` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`name` varchar(128) NOT NULL DEFAULT '',
|
6
|
-
`active` tinyint(1) unsigned DEFAULT '1',
|
7
|
-
`version` int(11) unsigned NOT NULL DEFAULT '1',
|
8
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
9
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
10
|
-
`user_owner` int(11) unsigned DEFAULT NULL,
|
11
|
-
`group_owner` int(11) unsigned DEFAULT NULL,
|
12
|
-
PRIMARY KEY (`id`),
|
13
|
-
UNIQUE KEY `name` (`name`),
|
14
|
-
KEY `active` (`active`)
|
15
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
16
|
-
end
|
17
|
-
|
18
|
-
down do
|
19
|
-
drop_table :chains
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `datacenters` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
6
|
-
`version` int(11) unsigned NOT NULL DEFAULT '1',
|
7
|
-
`name` varchar(128) NOT NULL DEFAULT '',
|
8
|
-
`user_owner` int(11) unsigned DEFAULT NULL,
|
9
|
-
`group_owner` int(11) unsigned DEFAULT NULL,
|
10
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
11
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
12
|
-
PRIMARY KEY (`id`),
|
13
|
-
UNIQUE KEY `name` (`name`),
|
14
|
-
KEY `active` (`active`)
|
15
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
16
|
-
end
|
17
|
-
|
18
|
-
down do
|
19
|
-
drop_table :datacenters
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `environments` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`name` varchar(128) NOT NULL DEFAULT '',
|
6
|
-
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
7
|
-
`version` int(11) unsigned NOT NULL DEFAULT '1',
|
8
|
-
`user_owner` int(11) unsigned DEFAULT NULL,
|
9
|
-
`group_owner` int(11) unsigned DEFAULT NULL,
|
10
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
11
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
12
|
-
PRIMARY KEY (`id`),
|
13
|
-
UNIQUE KEY `name` (`name`),
|
14
|
-
KEY `active` (`active`)
|
15
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
16
|
-
end
|
17
|
-
|
18
|
-
down do
|
19
|
-
drop_table :environments
|
20
|
-
end
|
21
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `functions` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
6
|
-
`version` int(11) unsigned NOT NULL DEFAULT '1',
|
7
|
-
`name` varchar(128) NOT NULL DEFAULT '',
|
8
|
-
`namespace_id` int(11) unsigned NOT NULL,
|
9
|
-
`args` text,
|
10
|
-
`user_owner` int(11) unsigned DEFAULT NULL,
|
11
|
-
`group_owner` int(11) unsigned DEFAULT NULL,
|
12
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
13
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
14
|
-
PRIMARY KEY (`id`),
|
15
|
-
UNIQUE KEY `namespace_id` (`namespace_id`,`name`),
|
16
|
-
KEY `active` (`active`),
|
17
|
-
KEY `namespace` (`namespace_id`),
|
18
|
-
KEY `name` (`name`)
|
19
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
20
|
-
end
|
21
|
-
|
22
|
-
down do
|
23
|
-
drop_table :functionss
|
24
|
-
end
|
25
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `namespaces` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
6
|
-
`namespace` varchar(128) NOT NULL DEFAULT '',
|
7
|
-
`queue` varchar(128) NOT NULL DEFAULT '',
|
8
|
-
`uri` varchar(128) DEFAULT NULL,
|
9
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
10
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
11
|
-
`group_owner` int(11) unsigned DEFAULT NULL,
|
12
|
-
`user_owner` int(11) unsigned DEFAULT NULL,
|
13
|
-
PRIMARY KEY (`id`),
|
14
|
-
UNIQUE KEY `namespace` (`namespace`),
|
15
|
-
KEY `active` (`active`),
|
16
|
-
KEY `queue` (`queue`),
|
17
|
-
KEY `uri` (`uri`)
|
18
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
19
|
-
end
|
20
|
-
|
21
|
-
down do
|
22
|
-
drop_table :namespaces
|
23
|
-
end
|
24
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `nodes` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
6
|
-
`name` varchar(128) NOT NULL DEFAULT '',
|
7
|
-
`datacenter_id` int(11) unsigned DEFAULT NULL,
|
8
|
-
`environment_id` int(11) unsigned DEFAULT NULL,
|
9
|
-
`status` varchar(255) NOT NULL DEFAULT 'unknown',
|
10
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
11
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
12
|
-
PRIMARY KEY (`id`),
|
13
|
-
UNIQUE KEY `name` (`name`),
|
14
|
-
KEY `active` (`active`),
|
15
|
-
KEY `status` (`status`)
|
16
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
17
|
-
end
|
18
|
-
|
19
|
-
down do
|
20
|
-
drop_table :nodes
|
21
|
-
end
|
22
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `relationships` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
6
|
-
`name` varchar(128) DEFAULT NULL,
|
7
|
-
`chain_id` int(11) unsigned DEFAULT NULL,
|
8
|
-
`trigger_id` int(11) unsigned NOT NULL,
|
9
|
-
`action_id` int(11) unsigned NOT NULL,
|
10
|
-
`delay` int(11) unsigned NOT NULL DEFAULT '0',
|
11
|
-
`conditions` text,
|
12
|
-
`transformation` text,
|
13
|
-
`version` tinyint(5) unsigned NOT NULL DEFAULT '1',
|
14
|
-
`created_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
15
|
-
`updated_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
16
|
-
`group_owner` int(11) unsigned DEFAULT NULL,
|
17
|
-
`user_owner` int(11) unsigned DEFAULT NULL,
|
18
|
-
PRIMARY KEY (`id`),
|
19
|
-
KEY `active` (`active`),
|
20
|
-
KEY `name` (`name`),
|
21
|
-
KEY `deplay` (`delay`)
|
22
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
23
|
-
end
|
24
|
-
|
25
|
-
down do
|
26
|
-
drop_table :relationships
|
27
|
-
end
|
28
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `task_logs` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`task_id` int(11) unsigned NOT NULL,
|
6
|
-
`node_id` int(11) unsigned NOT NULL,
|
7
|
-
`log` text,
|
8
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
9
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
10
|
-
PRIMARY KEY (`id`)
|
11
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
12
|
-
end
|
13
|
-
|
14
|
-
down do
|
15
|
-
drop_table :task_logs
|
16
|
-
end
|
17
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `tasks` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`status` varchar(64) NOT NULL DEFAULT 'created',
|
6
|
-
`payload` text,
|
7
|
-
`parent_id` int(11) unsigned DEFAULT NULL,
|
8
|
-
`master_id` int(11) unsigned DEFAULT NULL,
|
9
|
-
`version` tinyint(5) NOT NULL DEFAULT '1',
|
10
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
11
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
12
|
-
PRIMARY KEY (`id`),
|
13
|
-
KEY `status` (`status`)
|
14
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
15
|
-
end
|
16
|
-
|
17
|
-
down do
|
18
|
-
drop_table :tasks
|
19
|
-
end
|
20
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
up do
|
3
|
-
run "CREATE TABLE `users` (
|
4
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
-
`active` tinyint(1) unsigned DEFAULT '1',
|
6
|
-
`name` varchar(128) DEFAULT NULL,
|
7
|
-
`version` tinyint(5) unsigned NOT NULL DEFAULT '1',
|
8
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
9
|
-
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
10
|
-
PRIMARY KEY (`id`)
|
11
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
12
|
-
|
13
|
-
run "CREATE TABLE `groups` (
|
14
|
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
15
|
-
`active` tinyint(1) unsigned DEFAULT '1',
|
16
|
-
`name` varchar(128) DEFAULT NULL,
|
17
|
-
`version` tinyint(5) unsigned NOT NULL DEFAULT '1',
|
18
|
-
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
19
|
-
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
20
|
-
PRIMARY KEY (`id`)
|
21
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
22
|
-
end
|
23
|
-
|
24
|
-
down do
|
25
|
-
drop_table :groups
|
26
|
-
drop_table :users
|
27
|
-
end
|
28
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
transaction
|
3
|
-
up do
|
4
|
-
run 'ALTER TABLE `chains` ADD CONSTRAINT `chains_user_owner` FOREIGN KEY (`user_owner`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
5
|
-
run 'ALTER TABLE `chains` ADD CONSTRAINT `chains_group_owner` FOREIGN KEY (`group_owner`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
6
|
-
|
7
|
-
run 'ALTER TABLE `datacenters` ADD CONSTRAINT `datacenters_user_owner` FOREIGN KEY (`user_owner`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
8
|
-
run 'ALTER TABLE `datacenters` ADD CONSTRAINT `datacenters_group_owner` FOREIGN KEY (`group_owner`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
9
|
-
|
10
|
-
run 'ALTER TABLE `environments` ADD CONSTRAINT `environments_user_owner` FOREIGN KEY (`user_owner`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
11
|
-
run 'ALTER TABLE `environments` ADD CONSTRAINT `environments_group_owner` FOREIGN KEY (`group_owner`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
12
|
-
|
13
|
-
run 'ALTER TABLE `functions` ADD CONSTRAINT `functions_user_owner` FOREIGN KEY (`user_owner`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
14
|
-
run 'ALTER TABLE `functions` ADD CONSTRAINT `functions_group_owner` FOREIGN KEY (`group_owner`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
15
|
-
|
16
|
-
run 'ALTER TABLE `namespaces` ADD CONSTRAINT `namespaces_user_owner` FOREIGN KEY (`user_owner`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
17
|
-
run 'ALTER TABLE `namespaces` ADD CONSTRAINT `namespaces_group_owner` FOREIGN KEY (`group_owner`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
18
|
-
|
19
|
-
run 'ALTER TABLE `relationships` ADD CONSTRAINT `relationships_user_owner` FOREIGN KEY (`user_owner`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
20
|
-
run 'ALTER TABLE `relationships` ADD CONSTRAINT `relationships_group_owner` FOREIGN KEY (`group_owner`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
21
|
-
end
|
22
|
-
|
23
|
-
down do
|
24
|
-
run 'ALTER TABLE `relationships` DROP FOREIGN KEY `relationships_group_owner`;'
|
25
|
-
run 'ALTER TABLE `relationships` DROP FOREIGN KEY `relationships_user_owner`;'
|
26
|
-
|
27
|
-
run 'ALTER TABLE `namespaces` DROP FOREIGN KEY `namespaces_group_owner`;'
|
28
|
-
run 'ALTER TABLE `namespaces` DROP FOREIGN KEY `namespaces_user_owner`;'
|
29
|
-
|
30
|
-
run 'ALTER TABLE `functions` DROP FOREIGN KEY `functions_group_owner`;'
|
31
|
-
run 'ALTER TABLE `functions` DROP FOREIGN KEY `functions_user_owner`;'
|
32
|
-
|
33
|
-
run 'ALTER TABLE `environments` DROP FOREIGN KEY `environments_group_owner`;'
|
34
|
-
run 'ALTER TABLE `environments` DROP FOREIGN KEY `environments_user_owner`;'
|
35
|
-
|
36
|
-
run 'ALTER TABLE `datacenters` DROP FOREIGN KEY `datacenters_group_owner`;'
|
37
|
-
run 'ALTER TABLE `datacenters` DROP FOREIGN KEY `datacenters_user_owner`;'
|
38
|
-
|
39
|
-
run 'ALTER TABLE `chains` DROP FOREIGN KEY `chains_group_owner`;'
|
40
|
-
run 'ALTER TABLE `chains` DROP FOREIGN KEY `chains_user_owner`;'
|
41
|
-
end
|
42
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
transaction
|
3
|
-
up do
|
4
|
-
run 'ALTER TABLE `functions` ADD CONSTRAINT `function_namespace_id` FOREIGN KEY (`namespace_id`) REFERENCES `namespaces` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
5
|
-
end
|
6
|
-
|
7
|
-
down do
|
8
|
-
run 'ALTER TABLE `functions` DROP FOREIGN KEY `function_namespace_id`;'
|
9
|
-
end
|
10
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
transaction
|
3
|
-
up do
|
4
|
-
run 'ALTER TABLE `nodes` ADD CONSTRAINT `node_datacenter_id` FOREIGN KEY (`datacenter_id`) REFERENCES `datacenters` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
5
|
-
run 'ALTER TABLE `nodes` ADD CONSTRAINT `node_environment_id` FOREIGN KEY (`environment_id`) REFERENCES `environments` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
6
|
-
end
|
7
|
-
|
8
|
-
down do
|
9
|
-
run 'ALTER TABLE `nodes` DROP FOREIGN KEY `node_environment_id`;'
|
10
|
-
run 'ALTER TABLE `nodes` DROP FOREIGN KEY `node_datacenter_id`;'
|
11
|
-
end
|
12
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
transaction
|
3
|
-
up do
|
4
|
-
run 'ALTER TABLE `relationships` ADD CONSTRAINT `relationship_chain_id` FOREIGN KEY (`chain_id`) REFERENCES `chains` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
5
|
-
run 'ALTER TABLE `relationships` ADD CONSTRAINT `relationship_trigger_id` FOREIGN KEY (`trigger_id`) REFERENCES `functions` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
6
|
-
run 'ALTER TABLE `relationships` ADD CONSTRAINT `relationship_action_id` FOREIGN KEY (`action_id`) REFERENCES `functions` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
7
|
-
end
|
8
|
-
|
9
|
-
down do
|
10
|
-
run 'ALTER TABLE `relationships` DROP FOREIGN KEY `relationship_action_id`;'
|
11
|
-
run 'ALTER TABLE `relationships` DROP FOREIGN KEY `relationship_trigger_id`;'
|
12
|
-
run 'ALTER TABLE `relationships` DROP FOREIGN KEY `relationship_chain_id`;'
|
13
|
-
end
|
14
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
transaction
|
3
|
-
up do
|
4
|
-
run 'ALTER TABLE `tasks` ADD CONSTRAINT `task_master_id` FOREIGN KEY (`master_id`) REFERENCES `tasks` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
5
|
-
run 'ALTER TABLE `tasks` ADD CONSTRAINT `task_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `tasks` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
6
|
-
|
7
|
-
run 'ALTER TABLE `task_logs` CHANGE `node_id` `node_id` INT(11) UNSIGNED NULL;'
|
8
|
-
|
9
|
-
run 'ALTER TABLE `task_logs` ADD CONSTRAINT `task_logs_task_id` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
10
|
-
run 'ALTER TABLE `task_logs` ADD CONSTRAINT `task_logs_node_id` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;'
|
11
|
-
end
|
12
|
-
|
13
|
-
down do
|
14
|
-
run 'ALTER TABLE `task_logs` DROP FOREIGN KEY `task_logs_node_id`;'
|
15
|
-
run 'ALTER TABLE `task_logs` DROP FOREIGN KEY `task_logs_task_id`;'
|
16
|
-
|
17
|
-
run 'ALTER TABLE `task_logs` CHANGE `node_id` `node_id` INT(11) UNSIGNED NOT NULL;'
|
18
|
-
|
19
|
-
run 'ALTER TABLE `tasks` DROP FOREIGN KEY `task_parent_id`;'
|
20
|
-
run 'ALTER TABLE `tasks` DROP FOREIGN KEY `task_master_id`;'
|
21
|
-
end
|
22
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
transaction
|
3
|
-
up do
|
4
|
-
run 'ALTER TABLE `tasks` ADD `relationship_id` INT(11) UNSIGNED NOT NULL AFTER `status`;'
|
5
|
-
run 'ALTER TABLE `tasks` ADD CONSTRAINT `task_relationship_id` FOREIGN KEY (`relationship_id`) REFERENCES `relationships` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;'
|
6
|
-
end
|
7
|
-
|
8
|
-
down do
|
9
|
-
run 'ALTER TABLE `task_relationship_id` DROP FOREIGN KEY `node_id`;'
|
10
|
-
alter_table(:tasks) do
|
11
|
-
drop_column :relationship_id
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|