feat: restructure database schema and remove obsolete migrations
This commit is contained in:
parent
99401308d0
commit
1a049d1193
2
.env
2
.env
@ -1,5 +1,5 @@
|
|||||||
SUPABASE_URL="https://qsssikzgwomudkwfmgad.supabase.co"
|
SUPABASE_URL="https://qsssikzgwomudkwfmgad.supabase.co"
|
||||||
# DATABASE_URL="postgresql://postgres.qsssikzgwomudkwfmgad:etrTXNz3ZOwaLJmT@aws-0-eu-north-1.pooler.supabase.com:6543/postgres"
|
# DATABASE_URL="postgresql://postgres.qsssikzgwomudkwfmgad:etrTXNz3ZOwaLJmT@aws-0-eu-north-1.pooler.supabase.com:6543/postgres"
|
||||||
DATABASE_URL="postgresql://postgres.qsssikzgwomudkwfmgad:Wrongly1-Untimed0-Peculiar0-Unlikable7-Cubbyhole8@aws-0-eu-north-1.pooler.supabase.com:6543/postgre"
|
DATABASE_URL="postgresql://postgres.qsssikzgwomudkwfmgad:Wrongly1-Untimed0-Peculiar0-Unlikable7-Cubbyhole8@aws-0-eu-north-1.pooler.supabase.com:6543/postgres"
|
||||||
APIKEY_MAPS="AIzaSyAwfOShBqkBcS46WqmlsIVWQJ8gpdOPk_4"
|
APIKEY_MAPS="AIzaSyAwfOShBqkBcS46WqmlsIVWQJ8gpdOPk_4"
|
||||||
SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFzc3Npa3pnd29tdWRrd2ZtZ2FkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQzMjY1NTQsImV4cCI6MjA2OTkwMjU1NH0.BTSscdTcPP1GVmMB-H5caLpWsfuAw1V6mXiqogF8TjU"
|
SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFzc3Npa3pnd29tdWRrd2ZtZ2FkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQzMjY1NTQsImV4cCI6MjA2OTkwMjU1NH0.BTSscdTcPP1GVmMB-H5caLpWsfuAw1V6mXiqogF8TjU"
|
||||||
@ -1,8 +1,9 @@
|
|||||||
import { sql } from "drizzle-orm"
|
import { sql } from "drizzle-orm"
|
||||||
import {
|
import {
|
||||||
doublePrecision,
|
boolean,
|
||||||
foreignKey,
|
decimal,
|
||||||
integer,
|
integer,
|
||||||
|
jsonb,
|
||||||
pgPolicy,
|
pgPolicy,
|
||||||
pgTable,
|
pgTable,
|
||||||
serial,
|
serial,
|
||||||
@ -12,120 +13,122 @@ import {
|
|||||||
} from "drizzle-orm/pg-core"
|
} from "drizzle-orm/pg-core"
|
||||||
import { authenticatedRole, authUsers } from "drizzle-orm/supabase"
|
import { authenticatedRole, authUsers } from "drizzle-orm/supabase"
|
||||||
|
|
||||||
export const users = pgTable("demo", {
|
// === drones ===
|
||||||
id: serial("id").primaryKey(),
|
export const drones = pgTable("drones", {
|
||||||
fullName: text("full_name"),
|
id: serial("id").primaryKey().notNull(),
|
||||||
phone: varchar("phone", { length: 256 })
|
model: varchar("model", { length: 100 }),
|
||||||
})
|
brand: varchar("brand", { length: 100 }),
|
||||||
|
type: jsonb("type")
|
||||||
|
}).enableRLS()
|
||||||
|
|
||||||
export const profiles = pgTable(
|
// === certs ===
|
||||||
"profiles",
|
export const certs = pgTable("certs", {
|
||||||
|
id: serial("id").primaryKey().notNull(),
|
||||||
|
name: varchar("name", { length: 100 }),
|
||||||
|
link: text("link")
|
||||||
|
}).enableRLS()
|
||||||
|
|
||||||
|
// === places ===
|
||||||
|
export const places = pgTable(
|
||||||
|
"places",
|
||||||
{
|
{
|
||||||
id: uuid("id").notNull().primaryKey(),
|
id: serial("id").primaryKey().notNull(),
|
||||||
firstName: text("first_name"),
|
coord_x: decimal("coord_x"),
|
||||||
lastName: text("last_name")
|
coord_y: decimal("coord_y"),
|
||||||
|
description: varchar("description", { length: 255 }),
|
||||||
|
name: varchar("name", { length: 100 }),
|
||||||
|
id_user: uuid("id_user")
|
||||||
|
.notNull()
|
||||||
|
.references(() => authUsers.id, { onDelete: "cascade" }),
|
||||||
|
hidden_place: boolean("hidden_place")
|
||||||
},
|
},
|
||||||
(table) => [
|
(table) => [
|
||||||
foreignKey({
|
pgPolicy("select-own-places", {
|
||||||
columns: [table.id],
|
|
||||||
foreignColumns: [authUsers.id],
|
|
||||||
name: "profiles_id_fkey"
|
|
||||||
}).onDelete("cascade"),
|
|
||||||
pgPolicy("select-own-profile", {
|
|
||||||
for: "select",
|
for: "select",
|
||||||
to: authenticatedRole,
|
to: authenticatedRole,
|
||||||
using: sql`${table.id} = auth.uid()`
|
using: sql`${table.id_user} = auth.uid()`
|
||||||
}),
|
}),
|
||||||
pgPolicy("update-own-profile", {
|
pgPolicy("insert-own-places", {
|
||||||
for: "update",
|
|
||||||
to: authenticatedRole,
|
|
||||||
using: sql`${table.id} = auth.uid()`,
|
|
||||||
withCheck: sql`${table.id} = auth.uid()`
|
|
||||||
}),
|
|
||||||
pgPolicy("insert-profile", {
|
|
||||||
for: "insert",
|
for: "insert",
|
||||||
to: authenticatedRole,
|
to: authenticatedRole,
|
||||||
withCheck: sql`${table.id} = auth.uid()`
|
withCheck: sql`${table.id_user} = auth.uid()`
|
||||||
})
|
}),
|
||||||
]
|
pgPolicy("update-own-places", {
|
||||||
).enableRLS()
|
for: "update",
|
||||||
|
|
||||||
// === Catálogo de certificaciones ===
|
|
||||||
export const certifications = pgTable(
|
|
||||||
"certifications",
|
|
||||||
{
|
|
||||||
id: serial("id").primaryKey(),
|
|
||||||
name: text("name").notNull()
|
|
||||||
},
|
|
||||||
() => [
|
|
||||||
// Política: todos los usuarios autenticados pueden leer, nadie puede escribir
|
|
||||||
pgPolicy("select-certifications", {
|
|
||||||
for: "select",
|
|
||||||
to: authenticatedRole,
|
to: authenticatedRole,
|
||||||
using: sql`true`
|
using: sql`${table.id_user} = auth.uid()`,
|
||||||
|
withCheck: sql`${table.id_user} = auth.uid()`
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
).enableRLS()
|
).enableRLS()
|
||||||
|
|
||||||
// === Catálogo de modelos de drones ===
|
// === users_drones ===
|
||||||
export const droneModels = pgTable(
|
export const usersDrones = pgTable(
|
||||||
"drone_models",
|
"users_drones",
|
||||||
{
|
{
|
||||||
id: serial("id").primaryKey(),
|
id: serial("id").primaryKey().notNull(),
|
||||||
name: text("name").notNull()
|
id_drone: integer("id_drone").references(() => drones.id),
|
||||||
},
|
id_user: uuid("id_user").references(() => authUsers.id)
|
||||||
() => [
|
|
||||||
pgPolicy("select-drone-models", {
|
|
||||||
for: "select",
|
|
||||||
to: authenticatedRole,
|
|
||||||
using: sql`true`
|
|
||||||
})
|
|
||||||
]
|
|
||||||
).enableRLS()
|
|
||||||
|
|
||||||
// === Tabla principal de pilotos ===
|
|
||||||
export const pilots = pgTable(
|
|
||||||
"pilots",
|
|
||||||
{
|
|
||||||
id: uuid("id").notNull().primaryKey(), // Igual que auth.uid()
|
|
||||||
name: text("name"),
|
|
||||||
location: text("location"),
|
|
||||||
latitude: doublePrecision("latitude"),
|
|
||||||
longitude: doublePrecision("longitude"),
|
|
||||||
company: text("company"),
|
|
||||||
position: text("position"),
|
|
||||||
description: text("description"),
|
|
||||||
differentiation: text("differentiation"),
|
|
||||||
coverageAreas: text("coverage_areas"),
|
|
||||||
specializationAreas: text("specialization_areas"),
|
|
||||||
certificationIds: integer("certification_ids").array(), // IDs de tabla certifications
|
|
||||||
droneModelIds: integer("drone_model_ids").array(), // IDs de tabla drone_models
|
|
||||||
email: text("email")
|
|
||||||
},
|
},
|
||||||
(table) => [
|
(table) => [
|
||||||
// Relación con la tabla auth.users
|
pgPolicy("select-own-user-drones", {
|
||||||
foreignKey({
|
|
||||||
columns: [table.id],
|
|
||||||
foreignColumns: [authUsers.id],
|
|
||||||
name: "pilots_id_fkey"
|
|
||||||
}).onDelete("cascade"),
|
|
||||||
|
|
||||||
// === RLS ===
|
|
||||||
pgPolicy("select-own-pilot", {
|
|
||||||
for: "select",
|
for: "select",
|
||||||
to: authenticatedRole,
|
to: authenticatedRole,
|
||||||
using: sql`${table.id} = auth.uid()`
|
using: sql`${table.id_user} = auth.uid()`
|
||||||
}),
|
}),
|
||||||
pgPolicy("update-own-pilot", {
|
pgPolicy("insert-own-user-drones", {
|
||||||
for: "update",
|
|
||||||
to: authenticatedRole,
|
|
||||||
using: sql`${table.id} = auth.uid()`,
|
|
||||||
withCheck: sql`${table.id} = auth.uid()`
|
|
||||||
}),
|
|
||||||
pgPolicy("insert-pilot", {
|
|
||||||
for: "insert",
|
for: "insert",
|
||||||
to: authenticatedRole,
|
to: authenticatedRole,
|
||||||
withCheck: sql`${table.id} = auth.uid()`
|
withCheck: sql`${table.id_user} = auth.uid()`
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
).enableRLS()
|
).enableRLS()
|
||||||
|
|
||||||
|
// === users_certs ===
|
||||||
|
export const usersCerts = pgTable(
|
||||||
|
"users_certs",
|
||||||
|
{
|
||||||
|
id: serial("id").primaryKey().notNull(),
|
||||||
|
id_cert: integer("id_cert").references(() => certs.id),
|
||||||
|
id_user: uuid("id_user").references(() => authUsers.id)
|
||||||
|
},
|
||||||
|
(table) => [
|
||||||
|
pgPolicy("select-own-user-certs", {
|
||||||
|
for: "select",
|
||||||
|
to: authenticatedRole,
|
||||||
|
using: sql`${table.id_user} = auth.uid()`
|
||||||
|
}),
|
||||||
|
pgPolicy("insert-own-user-certs", {
|
||||||
|
for: "insert",
|
||||||
|
to: authenticatedRole,
|
||||||
|
withCheck: sql`${table.id_user} = auth.uid()`
|
||||||
|
})
|
||||||
|
]
|
||||||
|
).enableRLS()
|
||||||
|
|
||||||
|
// === users_places ===
|
||||||
|
export const usersPlaces = pgTable(
|
||||||
|
"users_places",
|
||||||
|
{
|
||||||
|
id: serial("id").primaryKey().notNull(),
|
||||||
|
id_place: integer("id_place").references(() => places.id),
|
||||||
|
id_user: uuid("id_user").references(() => authUsers.id)
|
||||||
|
},
|
||||||
|
(table) => [
|
||||||
|
pgPolicy("select-own-user-places", {
|
||||||
|
for: "select",
|
||||||
|
to: authenticatedRole,
|
||||||
|
using: sql`${table.id_user} = auth.uid()`
|
||||||
|
}),
|
||||||
|
pgPolicy("insert-own-user-places", {
|
||||||
|
for: "insert",
|
||||||
|
to: authenticatedRole,
|
||||||
|
withCheck: sql`${table.id_user} = auth.uid()`
|
||||||
|
})
|
||||||
|
]
|
||||||
|
).enableRLS()
|
||||||
|
|
||||||
|
// === equipment ===
|
||||||
|
export const equipment = pgTable("equipment", {
|
||||||
|
id: serial("id").primaryKey().notNull()
|
||||||
|
}).enableRLS()
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
IF NOT EXISTS CREATE TABLE "demo" (
|
|
||||||
"id" serial PRIMARY KEY NOT NULL,
|
|
||||||
"full_name" text,
|
|
||||||
"phone" varchar(256)
|
|
||||||
);
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
CREATE TABLE "profiles" (
|
|
||||||
"id" uuid PRIMARY KEY NOT NULL,
|
|
||||||
"first_name" text,
|
|
||||||
"last_name" text
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
ALTER TABLE "profiles" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
||||||
ALTER TABLE "profiles" ADD CONSTRAINT "profiles_id_fkey" FOREIGN KEY ("id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
||||||
CREATE POLICY "select-own-profile" ON "profiles" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("profiles"."id" = auth.uid());--> statement-breakpoint
|
|
||||||
CREATE POLICY "update-own-profile" ON "profiles" AS PERMISSIVE FOR UPDATE TO "authenticated" USING ("profiles"."id" = auth.uid()) WITH CHECK ("profiles"."id" = auth.uid());--> statement-breakpoint
|
|
||||||
CREATE POLICY "insert-profile" ON "profiles" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("profiles"."id" = auth.uid());
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
CREATE TABLE "certifications" (
|
|
||||||
"id" serial PRIMARY KEY NOT NULL,
|
|
||||||
"name" text NOT NULL
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
ALTER TABLE "certifications" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
||||||
CREATE TABLE "drone_models" (
|
|
||||||
"id" serial PRIMARY KEY NOT NULL,
|
|
||||||
"name" text NOT NULL
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
ALTER TABLE "drone_models" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
||||||
CREATE TABLE "pilots" (
|
|
||||||
"id" uuid PRIMARY KEY NOT NULL,
|
|
||||||
"name" text,
|
|
||||||
"location" text,
|
|
||||||
"latitude" double precision,
|
|
||||||
"longitude" double precision,
|
|
||||||
"company" text,
|
|
||||||
"position" text,
|
|
||||||
"description" text,
|
|
||||||
"differentiation" text,
|
|
||||||
"coverage_areas" text,
|
|
||||||
"specialization_areas" text,
|
|
||||||
"certification_ids" integer[],
|
|
||||||
"drone_model_ids" integer[],
|
|
||||||
"email" text
|
|
||||||
);
|
|
||||||
--> statement-breakpoint
|
|
||||||
ALTER TABLE "pilots" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
||||||
ALTER TABLE "pilots" ADD CONSTRAINT "pilots_id_fkey" FOREIGN KEY ("id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
||||||
CREATE POLICY "select-certifications" ON "certifications" AS PERMISSIVE FOR SELECT TO "authenticated" USING (true);--> statement-breakpoint
|
|
||||||
CREATE POLICY "select-drone-models" ON "drone_models" AS PERMISSIVE FOR SELECT TO "authenticated" USING (true);--> statement-breakpoint
|
|
||||||
CREATE POLICY "select-own-pilot" ON "pilots" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("pilots"."id" = auth.uid());--> statement-breakpoint
|
|
||||||
CREATE POLICY "update-own-pilot" ON "pilots" AS PERMISSIVE FOR UPDATE TO "authenticated" USING ("pilots"."id" = auth.uid()) WITH CHECK ("pilots"."id" = auth.uid());--> statement-breakpoint
|
|
||||||
CREATE POLICY "insert-pilot" ON "pilots" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("pilots"."id" = auth.uid());
|
|
||||||
68
src/integrations/supabase/migrations/0002_init.sql
Normal file
68
src/integrations/supabase/migrations/0002_init.sql
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
CREATE TABLE "certs" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"name" varchar(100),
|
||||||
|
"link" text
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "certs" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
CREATE TABLE "drones" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"model" varchar(100),
|
||||||
|
"brand" varchar(100),
|
||||||
|
"type" jsonb
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "drones" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
CREATE TABLE "equipment" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "equipment" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
CREATE TABLE "places" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"coord_x" numeric,
|
||||||
|
"coord_y" numeric,
|
||||||
|
"description" varchar(255),
|
||||||
|
"name" varchar(100),
|
||||||
|
"id_user" uuid NOT NULL,
|
||||||
|
"hidden_place" boolean
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "places" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
CREATE TABLE "users_certs" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"id_cert" integer,
|
||||||
|
"id_user" uuid
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_certs" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
CREATE TABLE "users_drones" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"id_drone" integer,
|
||||||
|
"id_user" uuid
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_drones" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
CREATE TABLE "users_places" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"id_place" integer,
|
||||||
|
"id_user" uuid
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_places" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||||
|
ALTER TABLE "places" ADD CONSTRAINT "places_id_user_users_id_fk" FOREIGN KEY ("id_user") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_certs" ADD CONSTRAINT "users_certs_id_cert_certs_id_fk" FOREIGN KEY ("id_cert") REFERENCES "public"."certs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_certs" ADD CONSTRAINT "users_certs_id_user_users_id_fk" FOREIGN KEY ("id_user") REFERENCES "auth"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_drones" ADD CONSTRAINT "users_drones_id_drone_drones_id_fk" FOREIGN KEY ("id_drone") REFERENCES "public"."drones"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_drones" ADD CONSTRAINT "users_drones_id_user_users_id_fk" FOREIGN KEY ("id_user") REFERENCES "auth"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_places" ADD CONSTRAINT "users_places_id_place_places_id_fk" FOREIGN KEY ("id_place") REFERENCES "public"."places"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "users_places" ADD CONSTRAINT "users_places_id_user_users_id_fk" FOREIGN KEY ("id_user") REFERENCES "auth"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||||
|
CREATE POLICY "select-own-places" ON "places" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("places"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "insert-own-places" ON "places" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("places"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "update-own-places" ON "places" AS PERMISSIVE FOR UPDATE TO "authenticated" USING ("places"."id_user" = auth.uid()) WITH CHECK ("places"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "select-own-user-certs" ON "users_certs" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("users_certs"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "insert-own-user-certs" ON "users_certs" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("users_certs"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "select-own-user-drones" ON "users_drones" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("users_drones"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "insert-own-user-drones" ON "users_drones" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("users_drones"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "select-own-user-places" ON "users_places" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("users_places"."id_user" = auth.uid());--> statement-breakpoint
|
||||||
|
CREATE POLICY "insert-own-user-places" ON "users_places" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("users_places"."id_user" = auth.uid());
|
||||||
@ -1,50 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "c266fe94-b863-4b6c-930c-44af8af68c1a",
|
|
||||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
||||||
"version": "7",
|
|
||||||
"dialect": "postgresql",
|
|
||||||
"tables": {
|
|
||||||
"public.demo": {
|
|
||||||
"name": "demo",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"full_name": {
|
|
||||||
"name": "full_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"phone": {
|
|
||||||
"name": "phone",
|
|
||||||
"type": "varchar(256)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {},
|
|
||||||
"schemas": {},
|
|
||||||
"sequences": {},
|
|
||||||
"roles": {},
|
|
||||||
"policies": {},
|
|
||||||
"views": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,125 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "7d0d4272-65ba-45cf-9dd3-a5e2008d3744",
|
|
||||||
"prevId": "c266fe94-b863-4b6c-930c-44af8af68c1a",
|
|
||||||
"version": "7",
|
|
||||||
"dialect": "postgresql",
|
|
||||||
"tables": {
|
|
||||||
"public.profiles": {
|
|
||||||
"name": "profiles",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"first_name": {
|
|
||||||
"name": "first_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"last_name": {
|
|
||||||
"name": "last_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"profiles_id_fkey": {
|
|
||||||
"name": "profiles_id_fkey",
|
|
||||||
"tableFrom": "profiles",
|
|
||||||
"tableTo": "users",
|
|
||||||
"schemaTo": "auth",
|
|
||||||
"columnsFrom": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "cascade",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {
|
|
||||||
"select-own-profile": {
|
|
||||||
"name": "select-own-profile",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "SELECT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "\"profiles\".\"id\" = auth.uid()"
|
|
||||||
},
|
|
||||||
"update-own-profile": {
|
|
||||||
"name": "update-own-profile",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "UPDATE",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "\"profiles\".\"id\" = auth.uid()",
|
|
||||||
"withCheck": "\"profiles\".\"id\" = auth.uid()"
|
|
||||||
},
|
|
||||||
"insert-profile": {
|
|
||||||
"name": "insert-profile",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "INSERT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"withCheck": "\"profiles\".\"id\" = auth.uid()"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": true
|
|
||||||
},
|
|
||||||
"public.demo": {
|
|
||||||
"name": "demo",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"full_name": {
|
|
||||||
"name": "full_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"phone": {
|
|
||||||
"name": "phone",
|
|
||||||
"type": "varchar(256)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {},
|
|
||||||
"schemas": {},
|
|
||||||
"sequences": {},
|
|
||||||
"roles": {},
|
|
||||||
"policies": {},
|
|
||||||
"views": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"id": "462e99b2-ba6b-4c91-9f6b-891795695955",
|
"id": "595b3231-9696-413e-b55b-5ec61cb86165",
|
||||||
"prevId": "7d0d4272-65ba-45cf-9dd3-a5e2008d3744",
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
"tables": {
|
"tables": {
|
||||||
"public.certifications": {
|
"public.certs": {
|
||||||
"name": "certifications",
|
"name": "certs",
|
||||||
"schema": "",
|
"schema": "",
|
||||||
"columns": {
|
"columns": {
|
||||||
"id": {
|
"id": {
|
||||||
@ -16,300 +16,14 @@
|
|||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"name": "name",
|
"name": "name",
|
||||||
|
"type": "varchar(100)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"link": {
|
||||||
|
"name": "link",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {
|
|
||||||
"select-certifications": {
|
|
||||||
"name": "select-certifications",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "SELECT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "true"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": true
|
|
||||||
},
|
|
||||||
"public.drone_models": {
|
|
||||||
"name": "drone_models",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"name": "name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {
|
|
||||||
"select-drone-models": {
|
|
||||||
"name": "select-drone-models",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "SELECT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "true"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": true
|
|
||||||
},
|
|
||||||
"public.pilots": {
|
|
||||||
"name": "pilots",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"name": "name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"location": {
|
|
||||||
"name": "location",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"company": {
|
|
||||||
"name": "company",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"position": {
|
|
||||||
"name": "position",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"differentiation": {
|
|
||||||
"name": "differentiation",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"coverage_areas": {
|
|
||||||
"name": "coverage_areas",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"specialization_areas": {
|
|
||||||
"name": "specialization_areas",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"certification_ids": {
|
|
||||||
"name": "certification_ids",
|
|
||||||
"type": "integer[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"drone_model_ids": {
|
|
||||||
"name": "drone_model_ids",
|
|
||||||
"type": "integer[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"pilots_id_fkey": {
|
|
||||||
"name": "pilots_id_fkey",
|
|
||||||
"tableFrom": "pilots",
|
|
||||||
"tableTo": "users",
|
|
||||||
"schemaTo": "auth",
|
|
||||||
"columnsFrom": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "cascade",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {
|
|
||||||
"select-own-pilot": {
|
|
||||||
"name": "select-own-pilot",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "SELECT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "\"pilots\".\"id\" = auth.uid()"
|
|
||||||
},
|
|
||||||
"update-own-pilot": {
|
|
||||||
"name": "update-own-pilot",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "UPDATE",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "\"pilots\".\"id\" = auth.uid()",
|
|
||||||
"withCheck": "\"pilots\".\"id\" = auth.uid()"
|
|
||||||
},
|
|
||||||
"insert-pilot": {
|
|
||||||
"name": "insert-pilot",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "INSERT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"withCheck": "\"pilots\".\"id\" = auth.uid()"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": true
|
|
||||||
},
|
|
||||||
"public.profiles": {
|
|
||||||
"name": "profiles",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"first_name": {
|
|
||||||
"name": "first_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"last_name": {
|
|
||||||
"name": "last_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"profiles_id_fkey": {
|
|
||||||
"name": "profiles_id_fkey",
|
|
||||||
"tableFrom": "profiles",
|
|
||||||
"tableTo": "users",
|
|
||||||
"schemaTo": "auth",
|
|
||||||
"columnsFrom": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "cascade",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {
|
|
||||||
"select-own-profile": {
|
|
||||||
"name": "select-own-profile",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "SELECT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "\"profiles\".\"id\" = auth.uid()"
|
|
||||||
},
|
|
||||||
"update-own-profile": {
|
|
||||||
"name": "update-own-profile",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "UPDATE",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"using": "\"profiles\".\"id\" = auth.uid()",
|
|
||||||
"withCheck": "\"profiles\".\"id\" = auth.uid()"
|
|
||||||
},
|
|
||||||
"insert-profile": {
|
|
||||||
"name": "insert-profile",
|
|
||||||
"as": "PERMISSIVE",
|
|
||||||
"for": "INSERT",
|
|
||||||
"to": [
|
|
||||||
"authenticated"
|
|
||||||
],
|
|
||||||
"withCheck": "\"profiles\".\"id\" = auth.uid()"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": true
|
|
||||||
},
|
|
||||||
"public.demo": {
|
|
||||||
"name": "demo",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"full_name": {
|
|
||||||
"name": "full_name",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"phone": {
|
|
||||||
"name": "phone",
|
|
||||||
"type": "varchar(256)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
"notNull": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -319,7 +33,396 @@
|
|||||||
"uniqueConstraints": {},
|
"uniqueConstraints": {},
|
||||||
"policies": {},
|
"policies": {},
|
||||||
"checkConstraints": {},
|
"checkConstraints": {},
|
||||||
"isRLSEnabled": false
|
"isRLSEnabled": true
|
||||||
|
},
|
||||||
|
"public.drones": {
|
||||||
|
"name": "drones",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"name": "model",
|
||||||
|
"type": "varchar(100)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"brand": {
|
||||||
|
"name": "brand",
|
||||||
|
"type": "varchar(100)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"name": "type",
|
||||||
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": true
|
||||||
|
},
|
||||||
|
"public.equipment": {
|
||||||
|
"name": "equipment",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": true
|
||||||
|
},
|
||||||
|
"public.places": {
|
||||||
|
"name": "places",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"coord_x": {
|
||||||
|
"name": "coord_x",
|
||||||
|
"type": "numeric",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"coord_y": {
|
||||||
|
"name": "coord_y",
|
||||||
|
"type": "numeric",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"name": "description",
|
||||||
|
"type": "varchar(255)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"name": "name",
|
||||||
|
"type": "varchar(100)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_user": {
|
||||||
|
"name": "id_user",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"hidden_place": {
|
||||||
|
"name": "hidden_place",
|
||||||
|
"type": "boolean",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"places_id_user_users_id_fk": {
|
||||||
|
"name": "places_id_user_users_id_fk",
|
||||||
|
"tableFrom": "places",
|
||||||
|
"tableTo": "users",
|
||||||
|
"schemaTo": "auth",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_user"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {
|
||||||
|
"select-own-places": {
|
||||||
|
"name": "select-own-places",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "SELECT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"using": "\"places\".\"id_user\" = auth.uid()"
|
||||||
|
},
|
||||||
|
"insert-own-places": {
|
||||||
|
"name": "insert-own-places",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "INSERT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"withCheck": "\"places\".\"id_user\" = auth.uid()"
|
||||||
|
},
|
||||||
|
"update-own-places": {
|
||||||
|
"name": "update-own-places",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "UPDATE",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"using": "\"places\".\"id_user\" = auth.uid()",
|
||||||
|
"withCheck": "\"places\".\"id_user\" = auth.uid()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": true
|
||||||
|
},
|
||||||
|
"public.users_certs": {
|
||||||
|
"name": "users_certs",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"id_cert": {
|
||||||
|
"name": "id_cert",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_user": {
|
||||||
|
"name": "id_user",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"users_certs_id_cert_certs_id_fk": {
|
||||||
|
"name": "users_certs_id_cert_certs_id_fk",
|
||||||
|
"tableFrom": "users_certs",
|
||||||
|
"tableTo": "certs",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_cert"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"users_certs_id_user_users_id_fk": {
|
||||||
|
"name": "users_certs_id_user_users_id_fk",
|
||||||
|
"tableFrom": "users_certs",
|
||||||
|
"tableTo": "users",
|
||||||
|
"schemaTo": "auth",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_user"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {
|
||||||
|
"select-own-user-certs": {
|
||||||
|
"name": "select-own-user-certs",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "SELECT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"using": "\"users_certs\".\"id_user\" = auth.uid()"
|
||||||
|
},
|
||||||
|
"insert-own-user-certs": {
|
||||||
|
"name": "insert-own-user-certs",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "INSERT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"withCheck": "\"users_certs\".\"id_user\" = auth.uid()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": true
|
||||||
|
},
|
||||||
|
"public.users_drones": {
|
||||||
|
"name": "users_drones",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"id_drone": {
|
||||||
|
"name": "id_drone",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_user": {
|
||||||
|
"name": "id_user",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"users_drones_id_drone_drones_id_fk": {
|
||||||
|
"name": "users_drones_id_drone_drones_id_fk",
|
||||||
|
"tableFrom": "users_drones",
|
||||||
|
"tableTo": "drones",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_drone"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"users_drones_id_user_users_id_fk": {
|
||||||
|
"name": "users_drones_id_user_users_id_fk",
|
||||||
|
"tableFrom": "users_drones",
|
||||||
|
"tableTo": "users",
|
||||||
|
"schemaTo": "auth",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_user"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {
|
||||||
|
"select-own-user-drones": {
|
||||||
|
"name": "select-own-user-drones",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "SELECT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"using": "\"users_drones\".\"id_user\" = auth.uid()"
|
||||||
|
},
|
||||||
|
"insert-own-user-drones": {
|
||||||
|
"name": "insert-own-user-drones",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "INSERT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"withCheck": "\"users_drones\".\"id_user\" = auth.uid()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": true
|
||||||
|
},
|
||||||
|
"public.users_places": {
|
||||||
|
"name": "users_places",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"id_place": {
|
||||||
|
"name": "id_place",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"id_user": {
|
||||||
|
"name": "id_user",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {
|
||||||
|
"users_places_id_place_places_id_fk": {
|
||||||
|
"name": "users_places_id_place_places_id_fk",
|
||||||
|
"tableFrom": "users_places",
|
||||||
|
"tableTo": "places",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_place"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"users_places_id_user_users_id_fk": {
|
||||||
|
"name": "users_places_id_user_users_id_fk",
|
||||||
|
"tableFrom": "users_places",
|
||||||
|
"tableTo": "users",
|
||||||
|
"schemaTo": "auth",
|
||||||
|
"columnsFrom": [
|
||||||
|
"id_user"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "no action",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {
|
||||||
|
"select-own-user-places": {
|
||||||
|
"name": "select-own-user-places",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "SELECT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"using": "\"users_places\".\"id_user\" = auth.uid()"
|
||||||
|
},
|
||||||
|
"insert-own-user-places": {
|
||||||
|
"name": "insert-own-user-places",
|
||||||
|
"as": "PERMISSIVE",
|
||||||
|
"for": "INSERT",
|
||||||
|
"to": [
|
||||||
|
"authenticated"
|
||||||
|
],
|
||||||
|
"withCheck": "\"users_places\".\"id_user\" = auth.uid()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enums": {},
|
"enums": {},
|
||||||
|
|||||||
@ -1,27 +1,13 @@
|
|||||||
{
|
{
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"idx": 0,
|
"idx": 2,
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"when": 1754932713212,
|
"when": 1762798763195,
|
||||||
"tag": "0000_talented_doorman",
|
"tag": "0002_init",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
},
|
}
|
||||||
{
|
]
|
||||||
"idx": 1,
|
|
||||||
"version": "7",
|
|
||||||
"when": 1755013739316,
|
|
||||||
"tag": "0001_nice_gargoyle",
|
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idx": 2,
|
|
||||||
"version": "7",
|
|
||||||
"when": 1755075449620,
|
|
||||||
"tag": "0002_bouncy_apocalypse",
|
|
||||||
"breakpoints": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user