mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 14:04:08 +01:00
chore: update migration - add goose down to migration
This commit is contained in:
parent
3d020fcd58
commit
4e601daa6c
@ -11,3 +11,7 @@ CREATE TABLE users (
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_users_uuid ON users(uuid);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX IF EXISTS idx_users_uuid;
|
||||
DROP TABLE IF EXISTS users;
|
||||
@ -66,3 +66,12 @@ CREATE TABLE croplands (
|
||||
CONSTRAINT fk_cropland_farm FOREIGN KEY (farm_id) REFERENCES farms(uuid) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_cropland_plant FOREIGN KEY (plant_id) REFERENCES plants(uuid) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS croplands;
|
||||
DROP TABLE IF EXISTS farms;
|
||||
DROP TABLE IF EXISTS plants;
|
||||
DROP TABLE IF EXISTS harvest_units;
|
||||
DROP TABLE IF EXISTS soil_conditions;
|
||||
DROP TABLE IF EXISTS light_profiles;
|
||||
@ -1,2 +1,6 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE farms DROP COLUMN plant_types;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE farms
|
||||
ADD COLUMN plant_types UUID[];
|
||||
17
backend/migrations/00004_update_farm_table.sql
Normal file
17
backend/migrations/00004_update_farm_table.sql
Normal file
@ -0,0 +1,17 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE farms
|
||||
ADD COLUMN farm_type TEXT,
|
||||
ADD COLUMN total_size TEXT;
|
||||
|
||||
ALTER TABLE farms
|
||||
ALTER COLUMN lat TYPE DOUBLE PRECISION USING lat[1],
|
||||
ALTER COLUMN lon TYPE DOUBLE PRECISION USING lon[1];
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE farms
|
||||
ALTER COLUMN lat TYPE DOUBLE PRECISION[] USING ARRAY[lat],
|
||||
ALTER COLUMN lon TYPE DOUBLE PRECISION[] USING ARRAY[lon];
|
||||
|
||||
ALTER TABLE farms
|
||||
DROP COLUMN farm_type,
|
||||
DROP COLUMN total_size;
|
||||
Loading…
Reference in New Issue
Block a user