mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: add automated actions tables (#5857)
Add tables to support automated actions based on the [design document](https://docs.google.com/document/d/15xPgn6B8gzMPk9RjMAUGu8XvozQ_45jjrsVl_Bm6Chg/edit?usp=sharinghttps://docs.google.com/document/d/15xPgn6B8gzMPk9RjMAUGu8XvozQ_45jjrsVl_Bm6Chg/edit?usp=sharing)
This commit is contained in:
		
							parent
							
								
									be579ba63b
								
							
						
					
					
						commit
						79d438ac46
					
				
							
								
								
									
										44
									
								
								src/migrations/20240111125100-automated-actions.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/migrations/20240111125100-automated-actions.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | ||||
| exports.up = function (db, cb) { | ||||
|     db.runSql( | ||||
|         ` | ||||
|         CREATE TABLE IF NOT EXISTS action_sets | ||||
|         ( | ||||
|             id SERIAL PRIMARY KEY NOT NULL, | ||||
|             created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), | ||||
|             created_by_user_id INTEGER, | ||||
|             name varchar(255), | ||||
|             project VARCHAR(255) NOT NULL, | ||||
|             actor_id INTEGER, | ||||
|             source varchar(255), | ||||
|             source_id INTEGER, | ||||
|             payload JSONB DEFAULT '{}'::jsonb NOT NULL, | ||||
|             FOREIGN KEY (project) references projects(id) ON DELETE CASCADE | ||||
|         ); | ||||
| 
 | ||||
|         CREATE TABLE IF NOT EXISTS actions | ||||
|         ( | ||||
|             id SERIAL PRIMARY KEY NOT NULL, | ||||
|             created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), | ||||
|             created_by_user_id INTEGER, | ||||
|             action_set_id INTEGER references action_sets (id) ON DELETE CASCADE, | ||||
|             sort_order INTEGER, | ||||
|             action varchar(255) NOT NULL, | ||||
|             execution_params JSONB DEFAULT '{}'::jsonb NOT NULL | ||||
|         ); | ||||
| 
 | ||||
|         CREATE INDEX idx_action_sets_project ON action_sets (project); | ||||
|         `,
 | ||||
|         cb, | ||||
|     ); | ||||
| }; | ||||
| 
 | ||||
| exports.down = function (db, cb) { | ||||
|     db.runSql( | ||||
|         ` | ||||
|         DROP INDEX IF EXISTS idx_action_sets_project; | ||||
|         DROP TABLE IF EXISTS actions; | ||||
|         DROP TABLE IF EXISTS action_sets; | ||||
|         `,
 | ||||
|         cb, | ||||
|     ); | ||||
| }; | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user