File tree Expand file tree Collapse file tree
packages/core/src/decoders Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ALTER TABLE prefs
2+ RENAME TO prefs_old;
3+
4+ CREATE TABLE
5+ prefs (
6+ id INTEGER PRIMARY KEY AUTOINCREMENT,
7+ user_id INTEGER NOT NULL ,
8+ base_ccy TEXT NOT NULL DEFAULT ' USD' ,
9+ additional TEXT NOT NULL DEFAULT ' {}' ,
10+ created DATETIME DEFAULT CURRENT_TIMESTAMP ,
11+ modified DATETIME DEFAULT CURRENT_TIMESTAMP ,
12+ FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ,
13+ UNIQUE (user_id)
14+ );
15+
16+ INSERT INTO
17+ prefs (
18+ id,
19+ user_id,
20+ base_ccy,
21+ additional,
22+ created,
23+ modified
24+ )
25+ SELECT
26+ id,
27+ user_id,
28+ base_ccy,
29+ ' {}' AS additional,
30+ created,
31+ modified
32+ FROM
33+ prefs_old;
34+
35+ DROP TRIGGER IF EXISTS insert_user_prefs;
36+
37+ CREATE TRIGGER insert_user_prefs AFTER INSERT ON users FOR EACH ROW BEGIN
38+ INSERT INTO
39+ prefs (user_id, base_ccy)
40+ VALUES
41+ (NEW .id , ' USD' );
42+
43+ END;
44+
45+ DROP TABLE prefs_old;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export const BASE_CCYS = [
1414 "DKK" ,
1515 "NZD" ,
1616 "JPY" ,
17+ "INR"
1718] as const ;
1819
1920export type Ccy = ( typeof BASE_CCYS ) [ number ] | "GBp" ;
@@ -26,13 +27,13 @@ export const CcyDecoder = pipe(
2627 codecs as [
2728 t . LiteralC < string > ,
2829 t . LiteralC < string > ,
29- ...t . LiteralC < string > [ ] ,
30+ ...t . LiteralC < string > [ ]
3031 ]
3132 )
3233) as t . Type < Ccy > ;
3334
3435const prefsTypes = {
35- base_ccy : CcyDecoder ,
36+ base_ccy : CcyDecoder
3637} ;
3738
3839export const PrefsDecoder = t . type ( prefsTypes ) ;
@@ -59,6 +60,8 @@ export const ccyToLocale = (ccy: Ccy): string => {
5960 return "en-NZ" ;
6061 case "JPY" :
6162 return "ja-JP" ;
63+ case "INR" :
64+ return "en-IN" ;
6265 case "USD" :
6366 default :
6467 return "en-US" ;
You can’t perform that action at this time.
0 commit comments