-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
474424d
commit 13aceee
Showing
7 changed files
with
284 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
...st_2e2_postgres/migration_with_change_migrations_with_change/20240527192300_enum.snap.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
SET statement_timeout = 0; | ||
SET lock_timeout = 0; | ||
SET idle_in_transaction_session_timeout = 0; | ||
SET client_encoding = 'UTF8'; | ||
SET standard_conforming_strings = on; | ||
SELECT pg_catalog.set_config('search_path', '', false); | ||
SET check_function_bodies = false; | ||
SET xmloption = content; | ||
SET client_min_messages = warning; | ||
SET row_security = off; | ||
|
||
-- | ||
-- Name: migrations_with_change; Type: SCHEMA; Schema: -; Owner: - | ||
-- | ||
|
||
CREATE SCHEMA migrations_with_change; | ||
|
||
|
||
-- | ||
-- Name: status; Type: TYPE; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
CREATE TYPE migrations_with_change.status AS ENUM ( | ||
'active', | ||
'inactive' | ||
); | ||
|
||
|
||
SET default_table_access_method = heap; | ||
|
||
-- | ||
-- Name: mig_schema_versions; Type: TABLE; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
CREATE TABLE migrations_with_change.mig_schema_versions ( | ||
id text NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- Name: users; Type: TABLE; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
CREATE TABLE migrations_with_change.users ( | ||
id integer NOT NULL, | ||
name text, | ||
email text, | ||
created_at timestamp(6) without time zone DEFAULT now() NOT NULL, | ||
updated_at timestamp(6) without time zone DEFAULT now() NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- Name: users_id_seq; Type: SEQUENCE; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
CREATE SEQUENCE migrations_with_change.users_id_seq | ||
AS integer | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1; | ||
|
||
|
||
-- | ||
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
ALTER SEQUENCE migrations_with_change.users_id_seq OWNED BY migrations_with_change.users.id; | ||
|
||
|
||
-- | ||
-- Name: users id; Type: DEFAULT; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY migrations_with_change.users ALTER COLUMN id SET DEFAULT nextval('migrations_with_change.users_id_seq'::regclass); | ||
|
||
|
||
-- | ||
-- Name: mig_schema_versions mig_schema_versions_pkey; Type: CONSTRAINT; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY migrations_with_change.mig_schema_versions | ||
ADD CONSTRAINT mig_schema_versions_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: users users_pkey; Type: CONSTRAINT; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY migrations_with_change.users | ||
ADD CONSTRAINT users_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: idx_users_email; Type: INDEX; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
CREATE UNIQUE INDEX idx_users_email ON migrations_with_change.users USING btree (email); | ||
|
||
|
||
-- | ||
-- Name: idx_users_name; Type: INDEX; Schema: migrations_with_change; Owner: - | ||
-- | ||
|
||
CREATE INDEX idx_users_name ON migrations_with_change.users USING btree (name); | ||
|
||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|
113 changes: 113 additions & 0 deletions
113
..._2e2_postgres/migration_with_classic_migrations_with_classic/20240527192355_enum.snap.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
SET statement_timeout = 0; | ||
SET lock_timeout = 0; | ||
SET idle_in_transaction_session_timeout = 0; | ||
SET client_encoding = 'UTF8'; | ||
SET standard_conforming_strings = on; | ||
SELECT pg_catalog.set_config('search_path', '', false); | ||
SET check_function_bodies = false; | ||
SET xmloption = content; | ||
SET client_min_messages = warning; | ||
SET row_security = off; | ||
|
||
-- | ||
-- Name: migrations_with_classic; Type: SCHEMA; Schema: -; Owner: - | ||
-- | ||
|
||
CREATE SCHEMA migrations_with_classic; | ||
|
||
|
||
-- | ||
-- Name: status; Type: TYPE; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
CREATE TYPE migrations_with_classic.status AS ENUM ( | ||
'active', | ||
'inactive' | ||
); | ||
|
||
|
||
SET default_table_access_method = heap; | ||
|
||
-- | ||
-- Name: mig_schema_versions; Type: TABLE; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
CREATE TABLE migrations_with_classic.mig_schema_versions ( | ||
id text NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- Name: users; Type: TABLE; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
CREATE TABLE migrations_with_classic.users ( | ||
id integer NOT NULL, | ||
name text, | ||
email text, | ||
created_at timestamp(6) without time zone DEFAULT now() NOT NULL, | ||
updated_at timestamp(6) without time zone DEFAULT now() NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- Name: users_id_seq; Type: SEQUENCE; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
CREATE SEQUENCE migrations_with_classic.users_id_seq | ||
AS integer | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1; | ||
|
||
|
||
-- | ||
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
ALTER SEQUENCE migrations_with_classic.users_id_seq OWNED BY migrations_with_classic.users.id; | ||
|
||
|
||
-- | ||
-- Name: users id; Type: DEFAULT; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY migrations_with_classic.users ALTER COLUMN id SET DEFAULT nextval('migrations_with_classic.users_id_seq'::regclass); | ||
|
||
|
||
-- | ||
-- Name: mig_schema_versions mig_schema_versions_pkey; Type: CONSTRAINT; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY migrations_with_classic.mig_schema_versions | ||
ADD CONSTRAINT mig_schema_versions_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: users users_pkey; Type: CONSTRAINT; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY migrations_with_classic.users | ||
ADD CONSTRAINT users_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: idx_users_email; Type: INDEX; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
CREATE UNIQUE INDEX idx_users_email ON migrations_with_classic.users USING btree (email); | ||
|
||
|
||
-- | ||
-- Name: idx_users_name; Type: INDEX; Schema: migrations_with_classic; Owner: - | ||
-- | ||
|
||
CREATE INDEX idx_users_name ON migrations_with_classic.users USING btree (name); | ||
|
||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|
24 changes: 24 additions & 0 deletions
24
testdata/e2e/pg/migrations_with_change/20240527192300_enum.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package migrations | ||
|
||
import ( | ||
"github.com/alexisvisco/amigo/pkg/schema" | ||
"github.com/alexisvisco/amigo/pkg/schema/pg" | ||
"time" | ||
) | ||
|
||
type Migration20240527192300Enum struct{} | ||
|
||
func (m Migration20240527192300Enum) Change(s *pg.Schema) { | ||
s.CreateEnum("status", []string{"active", "inactive"}, schema.CreateEnumOptions{ | ||
Schema: "migrations_with_change", | ||
}) | ||
} | ||
|
||
func (m Migration20240527192300Enum) Name() string { | ||
return "enum" | ||
} | ||
|
||
func (m Migration20240527192300Enum) Date() time.Time { | ||
t, _ := time.Parse(time.RFC3339, "2024-05-27T21:23:00+02:00") | ||
return t | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
testdata/e2e/pg/migrations_with_classic/20240527192355_enum.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package migrations | ||
|
||
import ( | ||
"github.com/alexisvisco/amigo/pkg/schema" | ||
"github.com/alexisvisco/amigo/pkg/schema/pg" | ||
"time" | ||
) | ||
|
||
type Migration20240527192355Enum struct{} | ||
|
||
func (m Migration20240527192355Enum) Up(s *pg.Schema) { | ||
s.CreateEnum("status", []string{"active", "inactive"}, schema.CreateEnumOptions{ | ||
Schema: "migrations_with_classic", | ||
}) | ||
} | ||
|
||
func (m Migration20240527192355Enum) Down(s *pg.Schema) { | ||
s.DropEnum("status", schema.DropEnumOptions{Schema: "migrations_with_classic"}) | ||
} | ||
|
||
func (m Migration20240527192355Enum) Name() string { | ||
return "enum" | ||
} | ||
|
||
func (m Migration20240527192355Enum) Date() time.Time { | ||
t, _ := time.Parse(time.RFC3339, "2024-05-27T21:23:55+02:00") | ||
return t | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters