I have tried using the atlas-operator as a way to manage some kubernetes databases. This has been done through setting a configmap an updating it
In order to create tables, i have created a config map as such.
`atlas:
configmap:
data:
20230101000000_default.sql: |-
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE OR REPLACE FUNCTION generate_ulid() RETURNS uuid AS $$
SELECT (lpad(to_hex(floor(extract(epoch FROM clock_timestamp()) * 1000)::bigint), 12, '0') || encode(gen_random_bytes(10), 'hex'))::uuid;
$$ LANGUAGE SQL;
20240619073705.sql: |
-- Create "User" table
CREATE TABLE "User" (
"username" text NOT NULL,
"createdAt" bigint NULL,
"updatedAt" bigint NULL,
"deletedAt" bigint NULL,
PRIMARY KEY ("username")
);
20240620035219.sql: |
-- Modify "User" table
ALTER TABLE "User" ADD COLUMN "name" text NULL;
atlas.sum: |
h1:gvpa8QxylwfWQm8OFna9Ldod62SfdzwZL+yqbCNM0C4=
20230101000000_default.sql h1:+4DhsPV7yqMBClAsIMTpapnOrMxbFM331bm90+uS6rQ=
20240619073705.sql h1:5KOd6j1MXg8aEZKWjKXxEBM2C9UtuOKRnGqPUAi/JHU=
20240620035219.sql h1:5NceGsRf2SZrvGOUPamljw3E9EJ8/wPTVGlrXSLgiBY=
name: migrationdir
`
and then to remove tables, i have tried this:
atlas: configmap: data: {} name: migrationdir
I cannot get the database to update and remove tables with this method
I have tried using the atlas-operator as a way to manage some kubernetes databases. This has been done through setting a configmap an updating it In order to create tables, i have created a config map as such.
`atlas: configmap: data: 20230101000000_default.sql: |- CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
`
and then to remove tables, i have tried this:
atlas: configmap: data: {} name: migrationdir
I cannot get the database to update and remove tables with this method