establish db
This commit is contained in:
46
apps/web/drizzle/0000_flippant_talon.sql
Normal file
46
apps/web/drizzle/0000_flippant_talon.sql
Normal file
@@ -0,0 +1,46 @@
|
||||
CREATE TABLE `diseases` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`plant_id` text NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`scientific_name` text DEFAULT '' NOT NULL,
|
||||
`causal_agent_type` text NOT NULL,
|
||||
`description` text DEFAULT '' NOT NULL,
|
||||
`symptoms` text DEFAULT '[]' NOT NULL,
|
||||
`causes` text DEFAULT '[]' NOT NULL,
|
||||
`treatment` text DEFAULT '[]' NOT NULL,
|
||||
`prevention` text DEFAULT '[]' NOT NULL,
|
||||
`lookalike_ids` text DEFAULT '[]' NOT NULL,
|
||||
`severity` text NOT NULL,
|
||||
`source_url` text DEFAULT '' NOT NULL,
|
||||
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
||||
`updated_at` text DEFAULT (datetime('now')) NOT NULL,
|
||||
FOREIGN KEY (`plant_id`) REFERENCES `plants`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `idx_diseases_plant_id` ON `diseases` (`plant_id`);--> statement-breakpoint
|
||||
CREATE INDEX `idx_diseases_causal_agent` ON `diseases` (`causal_agent_type`);--> statement-breakpoint
|
||||
CREATE INDEX `idx_diseases_severity` ON `diseases` (`severity`);--> statement-breakpoint
|
||||
CREATE TABLE `plants` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`common_name` text NOT NULL,
|
||||
`scientific_name` text NOT NULL,
|
||||
`family` text NOT NULL,
|
||||
`category` text NOT NULL,
|
||||
`care_summary` text DEFAULT '' NOT NULL,
|
||||
`image_url` text DEFAULT '' NOT NULL,
|
||||
`created_at` text DEFAULT (datetime('now')) NOT NULL,
|
||||
`updated_at` text DEFAULT (datetime('now')) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `idx_plants_category` ON `plants` (`category`);--> statement-breakpoint
|
||||
CREATE INDEX `idx_plants_common_name` ON `plants` (`common_name`);--> statement-breakpoint
|
||||
CREATE TABLE `scrape_sources` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`source_type` text NOT NULL,
|
||||
`source_url` text NOT NULL,
|
||||
`last_scraped_at` text,
|
||||
`entries_count` integer DEFAULT 0,
|
||||
`status` text DEFAULT 'pending' NOT NULL,
|
||||
`error_message` text,
|
||||
`created_at` text DEFAULT (datetime('now')) NOT NULL
|
||||
);
|
||||
340
apps/web/drizzle/meta/0000_snapshot.json
Normal file
340
apps/web/drizzle/meta/0000_snapshot.json
Normal file
@@ -0,0 +1,340 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "5471dc75-3736-4b26-b7a9-0629c9b1efa0",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"tables": {
|
||||
"diseases": {
|
||||
"name": "diseases",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"plant_id": {
|
||||
"name": "plant_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"scientific_name": {
|
||||
"name": "scientific_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "''"
|
||||
},
|
||||
"causal_agent_type": {
|
||||
"name": "causal_agent_type",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "''"
|
||||
},
|
||||
"symptoms": {
|
||||
"name": "symptoms",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'[]'"
|
||||
},
|
||||
"causes": {
|
||||
"name": "causes",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'[]'"
|
||||
},
|
||||
"treatment": {
|
||||
"name": "treatment",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'[]'"
|
||||
},
|
||||
"prevention": {
|
||||
"name": "prevention",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'[]'"
|
||||
},
|
||||
"lookalike_ids": {
|
||||
"name": "lookalike_ids",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'[]'"
|
||||
},
|
||||
"severity": {
|
||||
"name": "severity",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"source_url": {
|
||||
"name": "source_url",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "''"
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "(datetime('now'))"
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "(datetime('now'))"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"idx_diseases_plant_id": {
|
||||
"name": "idx_diseases_plant_id",
|
||||
"columns": [
|
||||
"plant_id"
|
||||
],
|
||||
"isUnique": false
|
||||
},
|
||||
"idx_diseases_causal_agent": {
|
||||
"name": "idx_diseases_causal_agent",
|
||||
"columns": [
|
||||
"causal_agent_type"
|
||||
],
|
||||
"isUnique": false
|
||||
},
|
||||
"idx_diseases_severity": {
|
||||
"name": "idx_diseases_severity",
|
||||
"columns": [
|
||||
"severity"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {
|
||||
"diseases_plant_id_plants_id_fk": {
|
||||
"name": "diseases_plant_id_plants_id_fk",
|
||||
"tableFrom": "diseases",
|
||||
"tableTo": "plants",
|
||||
"columnsFrom": [
|
||||
"plant_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"plants": {
|
||||
"name": "plants",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"common_name": {
|
||||
"name": "common_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"scientific_name": {
|
||||
"name": "scientific_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"family": {
|
||||
"name": "family",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"category": {
|
||||
"name": "category",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"care_summary": {
|
||||
"name": "care_summary",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "''"
|
||||
},
|
||||
"image_url": {
|
||||
"name": "image_url",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "''"
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "(datetime('now'))"
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "(datetime('now'))"
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"idx_plants_category": {
|
||||
"name": "idx_plants_category",
|
||||
"columns": [
|
||||
"category"
|
||||
],
|
||||
"isUnique": false
|
||||
},
|
||||
"idx_plants_common_name": {
|
||||
"name": "idx_plants_common_name",
|
||||
"columns": [
|
||||
"common_name"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"scrape_sources": {
|
||||
"name": "scrape_sources",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"source_type": {
|
||||
"name": "source_type",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"source_url": {
|
||||
"name": "source_url",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"last_scraped_at": {
|
||||
"name": "last_scraped_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"entries_count": {
|
||||
"name": "entries_count",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false,
|
||||
"default": 0
|
||||
},
|
||||
"status": {
|
||||
"name": "status",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'pending'"
|
||||
},
|
||||
"error_message": {
|
||||
"name": "error_message",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "(datetime('now'))"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
13
apps/web/drizzle/meta/_journal.json
Normal file
13
apps/web/drizzle/meta/_journal.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "sqlite",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "6",
|
||||
"when": 1780704072268,
|
||||
"tag": "0000_flippant_talon",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user