diff --git a/apps/db/migrations/25_comuni_provincie_nazioni.up.sql b/apps/db/migrations/25_comuni_provincie_nazioni.up.sql new file mode 100644 index 0000000..0711f67 --- /dev/null +++ b/apps/db/migrations/25_comuni_provincie_nazioni.up.sql @@ -0,0 +1,58 @@ +-- Comuni Table +CREATE TABLE IF NOT EXISTS public.comuni ( + id serial NOT NULL, + nome TEXT NOT NULL, + sigla TEXT NOT NULL, + catasto TEXT NOT NULL, +); +-- Primary Key +DO $$ BEGIN +ALTER TABLE public.comuni +ADD CONSTRAINT comuni_pkey PRIMARY KEY (id); + EXCEPTION + WHEN invalid_table_definition THEN + RAISE NOTICE 'Primary key already exists. Ignoring...'; +END $$; + +CREATE INDEX IF NOT EXISTS idx_comuni_nome ON comuni (nome); + +CREATE INDEX IF NOT EXISTS idx_comuni_sigla ON comuni (sigla); + +CREATE INDEX IF NOT EXISTS idx_comuni_nome_sigla ON comuni (nome, sigla); + +-- Provincie Table +CREATE TABLE IF NOT EXISTS public.provincie ( + id serial NOT NULL, + nome TEXT NOT NULL, + sigla TEXT NOT NULL, +); +-- Primary Key +DO $$ BEGIN +ALTER TABLE public.provincie +ADD CONSTRAINT provincie_pkey PRIMARY KEY (id); + EXCEPTION + WHEN invalid_table_definition THEN + RAISE NOTICE 'Primary key already exists. Ignoring...'; +END $$; + +CREATE INDEX IF NOT EXISTS idx_provincie_sigla ON provincie (sigla); + +CREATE INDEX IF NOT EXISTS idx_provincie_nome ON provincie (nome); + +-- Nazioni Table +CREATE TABLE IF NOT EXISTS public.nazioni ( + id serial NOT NULL, + nome TEXT NOT NULL, + catasto TEXT NOT NULL, +); + +-- Primary Key +DO $$ BEGIN +ALTER TABLE public.nazioni +ADD CONSTRAINT nazioni_pkey PRIMARY KEY (id); + EXCEPTION + WHEN invalid_table_definition THEN + RAISE NOTICE 'Primary key already exists. Ignoring...'; +END $$; + +CREATE INDEX IF NOT EXISTS idx_nazioni_nome ON nazioni (nome); \ No newline at end of file diff --git a/apps/infoalloggi/src/schemas/public/Comuni.ts b/apps/infoalloggi/src/schemas/public/Comuni.ts new file mode 100644 index 0000000..6efdfe6 --- /dev/null +++ b/apps/infoalloggi/src/schemas/public/Comuni.ts @@ -0,0 +1,24 @@ +// @generated +// This file is automatically generated by Kanel. Do not modify manually. + +import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely'; + +/** Identifier type for public.comuni */ +export type ComuniId = number & { __brand: 'public.comuni' }; + +/** Represents the table public.comuni */ +export default interface ComuniTable { + id: ColumnType; + + nome: ColumnType; + + sigla: ColumnType; + + catasto: ColumnType; +} + +export type Comuni = Selectable; + +export type NewComuni = Insertable; + +export type ComuniUpdate = Updateable; diff --git a/apps/infoalloggi/src/schemas/public/Nazioni.ts b/apps/infoalloggi/src/schemas/public/Nazioni.ts new file mode 100644 index 0000000..23cf71c --- /dev/null +++ b/apps/infoalloggi/src/schemas/public/Nazioni.ts @@ -0,0 +1,22 @@ +// @generated +// This file is automatically generated by Kanel. Do not modify manually. + +import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely'; + +/** Identifier type for public.nazioni */ +export type NazioniId = number & { __brand: 'public.nazioni' }; + +/** Represents the table public.nazioni */ +export default interface NazioniTable { + id: ColumnType; + + nome: ColumnType; + + catasto: ColumnType; +} + +export type Nazioni = Selectable; + +export type NewNazioni = Insertable; + +export type NazioniUpdate = Updateable; diff --git a/apps/infoalloggi/src/schemas/public/Provincie.ts b/apps/infoalloggi/src/schemas/public/Provincie.ts new file mode 100644 index 0000000..71dad50 --- /dev/null +++ b/apps/infoalloggi/src/schemas/public/Provincie.ts @@ -0,0 +1,22 @@ +// @generated +// This file is automatically generated by Kanel. Do not modify manually. + +import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely'; + +/** Identifier type for public.provincie */ +export type ProvincieId = number & { __brand: 'public.provincie' }; + +/** Represents the table public.provincie */ +export default interface ProvincieTable { + id: ColumnType; + + nome: ColumnType; + + sigla: ColumnType; +} + +export type Provincie = Selectable; + +export type NewProvincie = Insertable; + +export type ProvincieUpdate = Updateable; diff --git a/apps/infoalloggi/src/schemas/public/PublicSchema.ts b/apps/infoalloggi/src/schemas/public/PublicSchema.ts index 0cf0003..3333ef3 100644 --- a/apps/infoalloggi/src/schemas/public/PublicSchema.ts +++ b/apps/infoalloggi/src/schemas/public/PublicSchema.ts @@ -11,6 +11,7 @@ import type { default as UsersStorageTable } from './UsersStorage'; import type { default as ServizioAnnunciTable } from './ServizioAnnunci'; import type { default as EmailsTable } from './Emails'; import type { default as PaymentsTable } from './Payments'; +import type { default as ComuniTable } from './Comuni'; import type { default as EventQueueTable } from './EventQueue'; import type { default as OrdiniTable } from './Ordini'; import type { default as PrezziarioTable } from './Prezziario'; @@ -18,8 +19,10 @@ import type { default as RatelimiterTable } from './Ratelimiter'; import type { default as ChatsTable } from './Chats'; import type { default as EtichetteTable } from './Etichette'; import type { default as MessagesTable } from './Messages'; +import type { default as ProvincieTable } from './Provincie'; import type { default as UsersAnagraficaTable } from './UsersAnagrafica'; import type { default as BanlistTable } from './Banlist'; +import type { default as NazioniTable } from './Nazioni'; import type { default as ImagesRefsTable } from './ImagesRefs'; import type { default as BannersTable } from './Banners'; import type { default as ServizioTable } from './Servizio'; @@ -45,6 +48,8 @@ export default interface PublicSchema { payments: PaymentsTable; + comuni: ComuniTable; + event_queue: EventQueueTable; ordini: OrdiniTable; @@ -59,10 +64,14 @@ export default interface PublicSchema { messages: MessagesTable; + provincie: ProvincieTable; + users_anagrafica: UsersAnagraficaTable; banlist: BanlistTable; + nazioni: NazioniTable; + images_refs: ImagesRefsTable; banners: BannersTable;