290 lines
7.6 KiB
JSON
290 lines
7.6 KiB
JSON
|
|
{
|
||
|
|
"version": "6",
|
||
|
|
"dialect": "sqlite",
|
||
|
|
"id": "b981beaa-405c-48f1-8006-35f66d264062",
|
||
|
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||
|
|
"tables": {
|
||
|
|
"baskets": {
|
||
|
|
"name": "baskets",
|
||
|
|
"columns": {
|
||
|
|
"prefix": {
|
||
|
|
"name": "prefix",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"b_id": {
|
||
|
|
"name": "b_id",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"description": {
|
||
|
|
"name": "description",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": "''"
|
||
|
|
},
|
||
|
|
"donors": {
|
||
|
|
"name": "donors",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": "''"
|
||
|
|
},
|
||
|
|
"winning_ticket": {
|
||
|
|
"name": "winning_ticket",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": 0
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"indexes": {},
|
||
|
|
"foreignKeys": {},
|
||
|
|
"compositePrimaryKeys": {
|
||
|
|
"baskets_prefix_b_id_pk": {
|
||
|
|
"columns": [
|
||
|
|
"prefix",
|
||
|
|
"b_id"
|
||
|
|
],
|
||
|
|
"name": "baskets_prefix_b_id_pk"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"uniqueConstraints": {},
|
||
|
|
"checkConstraints": {}
|
||
|
|
},
|
||
|
|
"prefixes": {
|
||
|
|
"name": "prefixes",
|
||
|
|
"columns": {
|
||
|
|
"name": {
|
||
|
|
"name": "name",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": true,
|
||
|
|
"notNull": true,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"color": {
|
||
|
|
"name": "color",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"weight": {
|
||
|
|
"name": "weight",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": 0
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"indexes": {},
|
||
|
|
"foreignKeys": {},
|
||
|
|
"compositePrimaryKeys": {},
|
||
|
|
"uniqueConstraints": {},
|
||
|
|
"checkConstraints": {}
|
||
|
|
},
|
||
|
|
"tickets": {
|
||
|
|
"name": "tickets",
|
||
|
|
"columns": {
|
||
|
|
"prefix": {
|
||
|
|
"name": "prefix",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"t_id": {
|
||
|
|
"name": "t_id",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"first_name": {
|
||
|
|
"name": "first_name",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": "''"
|
||
|
|
},
|
||
|
|
"last_name": {
|
||
|
|
"name": "last_name",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": "''"
|
||
|
|
},
|
||
|
|
"phone_number": {
|
||
|
|
"name": "phone_number",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": "''"
|
||
|
|
},
|
||
|
|
"preference": {
|
||
|
|
"name": "preference",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false,
|
||
|
|
"default": "'CALL'"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"indexes": {},
|
||
|
|
"foreignKeys": {},
|
||
|
|
"compositePrimaryKeys": {
|
||
|
|
"tickets_prefix_t_id_pk": {
|
||
|
|
"columns": [
|
||
|
|
"prefix",
|
||
|
|
"t_id"
|
||
|
|
],
|
||
|
|
"name": "tickets_prefix_t_id_pk"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"uniqueConstraints": {},
|
||
|
|
"checkConstraints": {}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"views": {
|
||
|
|
"combined": {
|
||
|
|
"columns": {
|
||
|
|
"prefix": {
|
||
|
|
"name": "prefix",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"b_id": {
|
||
|
|
"name": "b_id",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"winning_ticket": {
|
||
|
|
"name": "winning_ticket",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"winner": {
|
||
|
|
"name": "winner",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"name": "combined",
|
||
|
|
"isExisting": false,
|
||
|
|
"definition": "SELECT b.prefix, b.b_id, b.winning_ticket, CONCAT(t.last_name, ', ', t.first_name) AS winner\n\tFROM baskets b LEFT JOIN tickets t\n\tON b.prefix = t.prefix AND b.winning_ticket = t.t_id\n\tORDER BY b.prefix, b.b_id"
|
||
|
|
},
|
||
|
|
"counts": {
|
||
|
|
"columns": {
|
||
|
|
"prefix": {
|
||
|
|
"name": "prefix",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"total_sold": {
|
||
|
|
"name": "total_sold",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"unique_sold": {
|
||
|
|
"name": "unique_sold",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"name": "counts",
|
||
|
|
"isExisting": false,
|
||
|
|
"definition": "SELECT prefix, COUNT(*) AS total_sold, COUNT(DISTINCT CONCAT(first_name,last_name,phone_number)) AS unique_sold\n\tFROM tickets\n\tGROUP BY prefix\n\tUNION ALL\n\tSELECT 'Total' AS prefix, COUNT(*) AS total_sold, COUNT(DISTINCT CONCAT(first_name,last_name,phone_number)) AS unique_sold\n\tFROM tickets;"
|
||
|
|
},
|
||
|
|
"report": {
|
||
|
|
"columns": {
|
||
|
|
"prefix": {
|
||
|
|
"name": "prefix",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"winner_name": {
|
||
|
|
"name": "winner_name",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"phone_number": {
|
||
|
|
"name": "phone_number",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"preference": {
|
||
|
|
"name": "preference",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"b_id": {
|
||
|
|
"name": "b_id",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"winning_ticket": {
|
||
|
|
"name": "winning_ticket",
|
||
|
|
"type": "integer",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
},
|
||
|
|
"description": {
|
||
|
|
"name": "description",
|
||
|
|
"type": "text",
|
||
|
|
"primaryKey": false,
|
||
|
|
"notNull": false,
|
||
|
|
"autoincrement": false
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"name": "report",
|
||
|
|
"isExisting": false,
|
||
|
|
"definition": "SELECT b.prefix, CONCAT(t.last_name, ', ', t.first_name) AS winner_name, t.phone_number, \tt.preference, b.b_id, b.winning_ticket, b.description\n\tFROM baskets b LEFT JOIN tickets t\n\tON b.prefix = t.prefix AND b.winning_ticket = t.t_id\n\tORDER BY b.prefix, winner_name, t.phone_number, t.preference, b.b_id"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"enums": {},
|
||
|
|
"_meta": {
|
||
|
|
"schemas": {},
|
||
|
|
"tables": {},
|
||
|
|
"columns": {}
|
||
|
|
},
|
||
|
|
"internal": {
|
||
|
|
"indexes": {}
|
||
|
|
}
|
||
|
|
}
|