feat(db): 新增金融資產枚舉與核心資產表 (assets)
This commit is contained in:
+16
-1
@@ -1,4 +1,4 @@
|
||||
import { pgTable, uuid, varchar, timestamp } from "drizzle-orm/pg-core";
|
||||
import { pgTable, uuid, varchar, timestamp, pgEnum } from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: uuid("id").primaryKey().defaultRandom(),
|
||||
@@ -8,3 +8,18 @@ export const users = pgTable("users", {
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const assetTypeEnum = pgEnum("asset_type_enum", [
|
||||
"STOCK",
|
||||
"CRYPTO",
|
||||
"CASH",
|
||||
]);
|
||||
|
||||
export const assets = pgTable("assets", {
|
||||
id: uuid("id").primaryKey().defaultRandom(),
|
||||
symbol: varchar("symbol", { length: 20 }).notNull().unique(),
|
||||
type: assetTypeEnum("type").notNull(),
|
||||
baseCurrency: varchar("base_currency", { length: 10 }).notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true, mode: "date" })
|
||||
.defaultNow(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user