@hedhog/admin 0.0.81 → 0.0.83
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__migrations/migrate-01.d.ts +6 -0
- package/dist/__migrations/migrate-01.d.ts.map +1 -0
- package/dist/__migrations/migrate-01.js +80 -0
- package/dist/__migrations/migrate-01.js.map +1 -0
- package/dist/__migrations/migrate-02.d.ts +6 -0
- package/dist/__migrations/migrate-02.d.ts.map +1 -0
- package/dist/__migrations/migrate-02.js +68 -0
- package/dist/__migrations/migrate-02.js.map +1 -0
- package/dist/__migrations/migrate-03.d.ts +6 -0
- package/dist/__migrations/migrate-03.d.ts.map +1 -0
- package/dist/__migrations/migrate-03.js +90 -0
- package/dist/__migrations/migrate-03.js.map +1 -0
- package/dist/__migrations/migrate-04.d.ts +6 -0
- package/dist/__migrations/migrate-04.d.ts.map +1 -0
- package/dist/__migrations/migrate-04.js +63 -0
- package/dist/__migrations/migrate-04.js.map +1 -0
- package/dist/__migrations/migrate-05.d.ts +6 -0
- package/dist/__migrations/migrate-05.d.ts.map +1 -0
- package/dist/__migrations/migrate-05.js +100 -0
- package/dist/__migrations/migrate-05.js.map +1 -0
- package/dist/__migrations/migrate-06.d.ts +6 -0
- package/dist/__migrations/migrate-06.d.ts.map +1 -0
- package/dist/__migrations/migrate-06.js +37 -0
- package/dist/__migrations/migrate-06.js.map +1 -0
- package/dist/__migrations/migrate-07.d.ts +6 -0
- package/dist/__migrations/migrate-07.d.ts.map +1 -0
- package/dist/__migrations/migrate-07.js +59 -0
- package/dist/__migrations/migrate-07.js.map +1 -0
- package/dist/__migrations/migrate-08.d.ts +6 -0
- package/dist/__migrations/migrate-08.d.ts.map +1 -0
- package/dist/__migrations/migrate-08.js +39 -0
- package/dist/__migrations/migrate-08.js.map +1 -0
- package/dist/__migrations/migrate-09.d.ts +6 -0
- package/dist/__migrations/migrate-09.d.ts.map +1 -0
- package/dist/__migrations/migrate-09.js +39 -0
- package/dist/__migrations/migrate-09.js.map +1 -0
- package/dist/__migrations/migrate-10.d.ts +6 -0
- package/dist/__migrations/migrate-10.d.ts.map +1 -0
- package/dist/__migrations/migrate-10.js +39 -0
- package/dist/__migrations/migrate-10.js.map +1 -0
- package/dist/__migrations/migrate-11.d.ts +6 -0
- package/dist/__migrations/migrate-11.d.ts.map +1 -0
- package/dist/__migrations/migrate-11.js +39 -0
- package/dist/__migrations/migrate-11.js.map +1 -0
- package/dist/__migrations/migrate-12.d.ts +6 -0
- package/dist/__migrations/migrate-12.d.ts.map +1 -0
- package/dist/__migrations/migrate-12.js +39 -0
- package/dist/__migrations/migrate-12.js.map +1 -0
- package/dist/__migrations/migrate-13.d.ts +6 -0
- package/dist/__migrations/migrate-13.d.ts.map +1 -0
- package/dist/__migrations/migrate-13.js +30 -0
- package/dist/__migrations/migrate-13.js.map +1 -0
- package/dist/__migrations/migrate-14.d.ts +6 -0
- package/dist/__migrations/migrate-14.d.ts.map +1 -0
- package/dist/__migrations/migrate-14.js +83 -0
- package/dist/__migrations/migrate-14.js.map +1 -0
- package/dist/__migrations/migrate-15.d.ts +6 -0
- package/dist/__migrations/migrate-15.d.ts.map +1 -0
- package/dist/__migrations/migrate-15.js +25 -0
- package/dist/__migrations/migrate-15.js.map +1 -0
- package/dist/__migrations/migrate-16.d.ts +6 -0
- package/dist/__migrations/migrate-16.d.ts.map +1 -0
- package/dist/__migrations/migrate-16.js +61 -0
- package/dist/__migrations/migrate-16.js.map +1 -0
- package/dist/__migrations/migrate-17.d.ts +6 -0
- package/dist/__migrations/migrate-17.d.ts.map +1 -0
- package/dist/__migrations/migrate-17.js +31 -0
- package/dist/__migrations/migrate-17.js.map +1 -0
- package/dist/__migrations/migrate-18.d.ts +6 -0
- package/dist/__migrations/migrate-18.d.ts.map +1 -0
- package/dist/__migrations/migrate-18.js +41 -0
- package/dist/__migrations/migrate-18.js.map +1 -0
- package/dist/__migrations/migrate-19.d.ts +6 -0
- package/dist/__migrations/migrate-19.d.ts.map +1 -0
- package/dist/__migrations/migrate-19.js +175 -0
- package/dist/__migrations/migrate-19.js.map +1 -0
- package/dist/__migrations/migrate-20.d.ts +6 -0
- package/dist/__migrations/migrate-20.d.ts.map +1 -0
- package/dist/__migrations/migrate-20.js +310 -0
- package/dist/__migrations/migrate-20.js.map +1 -0
- package/hedhog.yaml +487 -0
- package/package.json +1 -1
- package/src/migrations/migrate-01.ts +0 -86
- package/src/migrations/migrate-02.ts +0 -77
- package/src/migrations/migrate-03.ts +0 -102
- package/src/migrations/migrate-04.ts +0 -71
- package/src/migrations/migrate-05.ts +0 -119
- package/src/migrations/migrate-06.ts +0 -37
- package/src/migrations/migrate-07.ts +0 -66
- package/src/migrations/migrate-08.ts +0 -44
- package/src/migrations/migrate-09.ts +0 -44
- package/src/migrations/migrate-10.ts +0 -44
- package/src/migrations/migrate-11.ts +0 -45
- package/src/migrations/migrate-12.ts +0 -44
- package/src/migrations/migrate-13.ts +0 -28
- package/src/migrations/migrate-14.ts +0 -81
- package/src/migrations/migrate-15.ts +0 -23
- package/src/migrations/migrate-16.ts +0 -59
- package/src/migrations/migrate-17.ts +0 -29
- package/src/migrations/migrate-18.ts +0 -39
- package/src/migrations/migrate-19.ts +0 -186
- package/src/migrations/migrate-20.ts +0 -308
package/hedhog.yaml
CHANGED
@@ -1317,3 +1317,490 @@ data:
|
|
1317
1317
|
en: The font to use
|
1318
1318
|
pt: A fonte a utilizar
|
1319
1319
|
value: 'Arial, sans-serif'
|
1320
|
+
|
1321
|
+
tables:
|
1322
|
+
countries:
|
1323
|
+
columns:
|
1324
|
+
- type: pk
|
1325
|
+
- name: code
|
1326
|
+
type: char
|
1327
|
+
length: 3
|
1328
|
+
- type: created_at
|
1329
|
+
- type: updated_at
|
1330
|
+
ifNotExists: true
|
1331
|
+
|
1332
|
+
country_translations:
|
1333
|
+
columns:
|
1334
|
+
- name: country_id
|
1335
|
+
type: fk
|
1336
|
+
isPrimary: true
|
1337
|
+
references:
|
1338
|
+
table: countries
|
1339
|
+
column: id
|
1340
|
+
onDelete: CASCADE
|
1341
|
+
- name: locale_id
|
1342
|
+
isPrimary: true
|
1343
|
+
references:
|
1344
|
+
table: locales
|
1345
|
+
column: id
|
1346
|
+
onDelete: CASCADE
|
1347
|
+
- name: name
|
1348
|
+
- type: created_at
|
1349
|
+
- type: updated_at
|
1350
|
+
ifNotExists: true
|
1351
|
+
|
1352
|
+
translation_namespaces:
|
1353
|
+
columns:
|
1354
|
+
- type: pk
|
1355
|
+
- name: name
|
1356
|
+
- type: created_at
|
1357
|
+
- type: updated_at
|
1358
|
+
ifNotExists: true
|
1359
|
+
|
1360
|
+
translations:
|
1361
|
+
columns:
|
1362
|
+
- type: pk
|
1363
|
+
- name: locale_id
|
1364
|
+
type: fk
|
1365
|
+
references:
|
1366
|
+
table: locales
|
1367
|
+
column: id
|
1368
|
+
onDelete: CASCADE
|
1369
|
+
- name: namespace_id
|
1370
|
+
type: fk
|
1371
|
+
references:
|
1372
|
+
table: translation_namespaces
|
1373
|
+
column: id
|
1374
|
+
onDelete: CASCADE
|
1375
|
+
- name: name
|
1376
|
+
- name: value
|
1377
|
+
- type: created_at
|
1378
|
+
- type: updated_at
|
1379
|
+
indices:
|
1380
|
+
- columns:
|
1381
|
+
- locale_id
|
1382
|
+
- namespace_id
|
1383
|
+
- name
|
1384
|
+
isUnique: true
|
1385
|
+
ifNotExists: true
|
1386
|
+
|
1387
|
+
multifactors:
|
1388
|
+
columns:
|
1389
|
+
- type: pk
|
1390
|
+
- type: slug
|
1391
|
+
- type: created_at
|
1392
|
+
- type: updated_at
|
1393
|
+
ifNotExists: true
|
1394
|
+
|
1395
|
+
multifactor_translations:
|
1396
|
+
columns:
|
1397
|
+
- name: multifactor_id
|
1398
|
+
type: fk
|
1399
|
+
isPrimary: true
|
1400
|
+
references:
|
1401
|
+
table: multifactors
|
1402
|
+
column: id
|
1403
|
+
onDelete: CASCADE
|
1404
|
+
- name: locale_id
|
1405
|
+
type: fk
|
1406
|
+
isPrimary: true
|
1407
|
+
references:
|
1408
|
+
table: locales
|
1409
|
+
column: id
|
1410
|
+
onDelete: CASCADE
|
1411
|
+
- name: name
|
1412
|
+
- type: created_at
|
1413
|
+
- type: updated_at
|
1414
|
+
ifNotExists: true
|
1415
|
+
|
1416
|
+
users:
|
1417
|
+
columns:
|
1418
|
+
- type: pk
|
1419
|
+
- name: multifactor_id
|
1420
|
+
type: fk
|
1421
|
+
isNullable: true
|
1422
|
+
references:
|
1423
|
+
table: multifactors
|
1424
|
+
column: id
|
1425
|
+
onDelete: SET NULL
|
1426
|
+
- name: name
|
1427
|
+
- name: email
|
1428
|
+
- name: password
|
1429
|
+
- name: code
|
1430
|
+
isNullable: true
|
1431
|
+
- type: created_at
|
1432
|
+
- type: updated_at
|
1433
|
+
ifNotExists: true
|
1434
|
+
|
1435
|
+
screens:
|
1436
|
+
columns:
|
1437
|
+
- type: pk
|
1438
|
+
- type: slug
|
1439
|
+
- name: icon
|
1440
|
+
isNullable: true
|
1441
|
+
- type: created_at
|
1442
|
+
- type: updated_at
|
1443
|
+
ifNotExists: true
|
1444
|
+
|
1445
|
+
screen_translations:
|
1446
|
+
columns:
|
1447
|
+
- name: screen_id
|
1448
|
+
type: fk
|
1449
|
+
isPrimary: true
|
1450
|
+
references:
|
1451
|
+
table: screens
|
1452
|
+
column: id
|
1453
|
+
onDelete: CASCADE
|
1454
|
+
- name: locale_id
|
1455
|
+
type: fk
|
1456
|
+
isPrimary: true
|
1457
|
+
references:
|
1458
|
+
table: locales
|
1459
|
+
column: id
|
1460
|
+
onDelete: CASCADE
|
1461
|
+
- name: name
|
1462
|
+
- name: description
|
1463
|
+
- type: created_at
|
1464
|
+
- type: updated_at
|
1465
|
+
ifNotExists: true
|
1466
|
+
|
1467
|
+
menus:
|
1468
|
+
columns:
|
1469
|
+
- type: pk
|
1470
|
+
- name: menu_id
|
1471
|
+
type: fk
|
1472
|
+
isNullable: true
|
1473
|
+
references:
|
1474
|
+
table: menus
|
1475
|
+
column: id
|
1476
|
+
onDelete: CASCADE
|
1477
|
+
- type: slug
|
1478
|
+
- name: url
|
1479
|
+
isNullable: true
|
1480
|
+
- name: order
|
1481
|
+
type: int
|
1482
|
+
default: 0
|
1483
|
+
unsigned: true
|
1484
|
+
- name: icon
|
1485
|
+
isNullable: true
|
1486
|
+
- type: created_at
|
1487
|
+
- type: updated_at
|
1488
|
+
ifNotExists: true
|
1489
|
+
|
1490
|
+
menu_translations:
|
1491
|
+
columns:
|
1492
|
+
- name: menu_id
|
1493
|
+
type: fk
|
1494
|
+
isPrimary: true
|
1495
|
+
references:
|
1496
|
+
table: menus
|
1497
|
+
column: id
|
1498
|
+
onDelete: CASCADE
|
1499
|
+
- name: locale_id
|
1500
|
+
type: fk
|
1501
|
+
isPrimary: true
|
1502
|
+
references:
|
1503
|
+
table: locales
|
1504
|
+
column: id
|
1505
|
+
onDelete: CASCADE
|
1506
|
+
- name: name
|
1507
|
+
- type: created_at
|
1508
|
+
- type: updated_at
|
1509
|
+
ifNotExists: true
|
1510
|
+
|
1511
|
+
menu_screens:
|
1512
|
+
columns:
|
1513
|
+
- name: menu_id
|
1514
|
+
type: fk
|
1515
|
+
isPrimary: true
|
1516
|
+
references:
|
1517
|
+
table: menus
|
1518
|
+
column: id
|
1519
|
+
onDelete: CASCADE
|
1520
|
+
- name: screen_id
|
1521
|
+
type: fk
|
1522
|
+
isPrimary: true
|
1523
|
+
references:
|
1524
|
+
table: screens
|
1525
|
+
column: id
|
1526
|
+
onDelete: CASCADE
|
1527
|
+
ifNotExists: true
|
1528
|
+
|
1529
|
+
routes:
|
1530
|
+
columns:
|
1531
|
+
- type: pk
|
1532
|
+
- name: url
|
1533
|
+
- name: method
|
1534
|
+
type: enum
|
1535
|
+
enum:
|
1536
|
+
- GET
|
1537
|
+
- POST
|
1538
|
+
- PATCH
|
1539
|
+
- DELETE
|
1540
|
+
- PUT
|
1541
|
+
- OPTIONS
|
1542
|
+
- HEAD
|
1543
|
+
- type: created_at
|
1544
|
+
- type: updated_at
|
1545
|
+
indices:
|
1546
|
+
- columns: ['url', 'method']
|
1547
|
+
isUnique: true
|
1548
|
+
ifNotExists: true
|
1549
|
+
|
1550
|
+
roles:
|
1551
|
+
columns:
|
1552
|
+
- type: pk
|
1553
|
+
- type: slug
|
1554
|
+
- type: created_at
|
1555
|
+
- type: updated_at
|
1556
|
+
ifNotExists: true
|
1557
|
+
|
1558
|
+
role_translations:
|
1559
|
+
columns:
|
1560
|
+
- name: role_id
|
1561
|
+
type: fk
|
1562
|
+
isPrimary: true
|
1563
|
+
references:
|
1564
|
+
table: roles
|
1565
|
+
column: id
|
1566
|
+
onDelete: CASCADE
|
1567
|
+
- name: locale_id
|
1568
|
+
type: fk
|
1569
|
+
isPrimary: true
|
1570
|
+
references:
|
1571
|
+
table: locales
|
1572
|
+
column: id
|
1573
|
+
onDelete: CASCADE
|
1574
|
+
- name: name
|
1575
|
+
- name: description
|
1576
|
+
- type: created_at
|
1577
|
+
- type: updated_at
|
1578
|
+
ifNotExists: true
|
1579
|
+
|
1580
|
+
role_menus:
|
1581
|
+
columns:
|
1582
|
+
- name: role_id
|
1583
|
+
type: fk
|
1584
|
+
isPrimary: true
|
1585
|
+
references:
|
1586
|
+
table: roles
|
1587
|
+
column: id
|
1588
|
+
onDelete: CASCADE
|
1589
|
+
- name: menu_id
|
1590
|
+
type: fk
|
1591
|
+
isPrimary: true
|
1592
|
+
references:
|
1593
|
+
table: menus
|
1594
|
+
column: id
|
1595
|
+
onDelete: CASCADE
|
1596
|
+
- type: created_at
|
1597
|
+
- type: updated_at
|
1598
|
+
ifNotExists: true
|
1599
|
+
|
1600
|
+
route_screens:
|
1601
|
+
columns:
|
1602
|
+
- name: route_id
|
1603
|
+
type: fk
|
1604
|
+
isPrimary: true
|
1605
|
+
references:
|
1606
|
+
table: routes
|
1607
|
+
column: id
|
1608
|
+
onDelete: CASCADE
|
1609
|
+
- name: screen_id
|
1610
|
+
type: fk
|
1611
|
+
isPrimary: true
|
1612
|
+
references:
|
1613
|
+
table: screens
|
1614
|
+
column: id
|
1615
|
+
onDelete: CASCADE
|
1616
|
+
- type: created_at
|
1617
|
+
- type: updated_at
|
1618
|
+
ifNotExists: true
|
1619
|
+
|
1620
|
+
role_screens:
|
1621
|
+
columns:
|
1622
|
+
- name: role_id
|
1623
|
+
type: fk
|
1624
|
+
isPrimary: true
|
1625
|
+
references:
|
1626
|
+
table: roles
|
1627
|
+
column: id
|
1628
|
+
onDelete: CASCADE
|
1629
|
+
- name: screen_id
|
1630
|
+
type: fk
|
1631
|
+
isPrimary: true
|
1632
|
+
references:
|
1633
|
+
table: screens
|
1634
|
+
column: id
|
1635
|
+
onDelete: CASCADE
|
1636
|
+
- type: created_at
|
1637
|
+
- type: updated_at
|
1638
|
+
ifNotExists: true
|
1639
|
+
|
1640
|
+
role_users:
|
1641
|
+
columns:
|
1642
|
+
- name: role_id
|
1643
|
+
type: fk
|
1644
|
+
isPrimary: true
|
1645
|
+
references:
|
1646
|
+
table: roles
|
1647
|
+
column: id
|
1648
|
+
onDelete: CASCADE
|
1649
|
+
- name: user_id
|
1650
|
+
type: fk
|
1651
|
+
isPrimary: true
|
1652
|
+
references:
|
1653
|
+
table: users
|
1654
|
+
column: id
|
1655
|
+
onDelete: CASCADE
|
1656
|
+
- type: created_at
|
1657
|
+
- type: updated_at
|
1658
|
+
ifNotExists: true
|
1659
|
+
|
1660
|
+
role_routes:
|
1661
|
+
columns:
|
1662
|
+
- name: role_id
|
1663
|
+
type: fk
|
1664
|
+
isPrimary: true
|
1665
|
+
references:
|
1666
|
+
table: roles
|
1667
|
+
column: id
|
1668
|
+
onDelete: CASCADE
|
1669
|
+
- name: route_id
|
1670
|
+
type: fk
|
1671
|
+
isPrimary: true
|
1672
|
+
references:
|
1673
|
+
table: routes
|
1674
|
+
column: id
|
1675
|
+
onDelete: CASCADE
|
1676
|
+
- type: created_at
|
1677
|
+
- type: updated_at
|
1678
|
+
ifNotExists: true
|
1679
|
+
|
1680
|
+
setting_groups:
|
1681
|
+
columns:
|
1682
|
+
- type: pk
|
1683
|
+
- name: icon
|
1684
|
+
length: 31
|
1685
|
+
- type: slug
|
1686
|
+
- type: created_at
|
1687
|
+
- type: updated_at
|
1688
|
+
ifNotExists: true
|
1689
|
+
|
1690
|
+
setting_group_translations:
|
1691
|
+
columns:
|
1692
|
+
- name: locale_id
|
1693
|
+
type: fk
|
1694
|
+
isPrimary: true
|
1695
|
+
references:
|
1696
|
+
table: locales
|
1697
|
+
column: id
|
1698
|
+
onDelete: CASCADE
|
1699
|
+
- name: group_id
|
1700
|
+
type: fk
|
1701
|
+
isPrimary: true
|
1702
|
+
references:
|
1703
|
+
table: setting_groups
|
1704
|
+
column: id
|
1705
|
+
onDelete: CASCADE
|
1706
|
+
- name: name
|
1707
|
+
length: 63
|
1708
|
+
- name: description
|
1709
|
+
length: 255
|
1710
|
+
isNullable: true
|
1711
|
+
- type: created_at
|
1712
|
+
- type: updated_at
|
1713
|
+
ifNotExists: true
|
1714
|
+
|
1715
|
+
settings:
|
1716
|
+
columns:
|
1717
|
+
- type: pk
|
1718
|
+
- name: group_id
|
1719
|
+
type: fk
|
1720
|
+
references:
|
1721
|
+
table: setting_groups
|
1722
|
+
column: id
|
1723
|
+
onDelete: CASCADE
|
1724
|
+
- type: slug
|
1725
|
+
- name: type
|
1726
|
+
type: enum
|
1727
|
+
enum:
|
1728
|
+
- string
|
1729
|
+
- number
|
1730
|
+
- boolean
|
1731
|
+
- json
|
1732
|
+
default: string
|
1733
|
+
- name: value
|
1734
|
+
length: 1023
|
1735
|
+
isNullable: true
|
1736
|
+
- name: userOverride
|
1737
|
+
type: boolean
|
1738
|
+
default: false
|
1739
|
+
- type: created_at
|
1740
|
+
- type: updated_at
|
1741
|
+
ifNotExists: true
|
1742
|
+
|
1743
|
+
setting_translations:
|
1744
|
+
columns:
|
1745
|
+
- name: locale_id
|
1746
|
+
type: fk
|
1747
|
+
isPrimary: true
|
1748
|
+
references:
|
1749
|
+
table: locales
|
1750
|
+
column: id
|
1751
|
+
onDelete: CASCADE
|
1752
|
+
- name: setting_id
|
1753
|
+
type: fk
|
1754
|
+
isPrimary: true
|
1755
|
+
references:
|
1756
|
+
table: settings
|
1757
|
+
column: id
|
1758
|
+
onDelete: CASCADE
|
1759
|
+
- name: description
|
1760
|
+
length: 255
|
1761
|
+
isNullable: true
|
1762
|
+
- name: name
|
1763
|
+
length: 63
|
1764
|
+
isNullable: true
|
1765
|
+
- type: created_at
|
1766
|
+
- type: updated_at
|
1767
|
+
ifNotExists: true
|
1768
|
+
|
1769
|
+
setting_users:
|
1770
|
+
columns:
|
1771
|
+
- name: user_id
|
1772
|
+
type: fk
|
1773
|
+
isPrimary: true
|
1774
|
+
references:
|
1775
|
+
table: users
|
1776
|
+
column: id
|
1777
|
+
onDelete: CASCADE
|
1778
|
+
- name: setting_id
|
1779
|
+
type: fk
|
1780
|
+
isPrimary: true
|
1781
|
+
references:
|
1782
|
+
table: settings
|
1783
|
+
column: id
|
1784
|
+
onDelete: CASCADE
|
1785
|
+
- name: value
|
1786
|
+
length: 1023
|
1787
|
+
isNullable: true
|
1788
|
+
- type: created_at
|
1789
|
+
- type: updated_at
|
1790
|
+
ifNotExists: true
|
1791
|
+
|
1792
|
+
locales:
|
1793
|
+
columns:
|
1794
|
+
- type: pk
|
1795
|
+
- name: code
|
1796
|
+
type: char
|
1797
|
+
length: 2
|
1798
|
+
- name: region
|
1799
|
+
type: char
|
1800
|
+
length: 2
|
1801
|
+
- name: enabled
|
1802
|
+
type: boolean
|
1803
|
+
default: true
|
1804
|
+
- type: created_at
|
1805
|
+
- type: updated_at
|
1806
|
+
ifNotExists: true
|
package/package.json
CHANGED
@@ -1,86 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
2
|
-
import { idColumn, timestampColumn, foreignColumn } from '@hedhog/utils';
|
3
|
-
|
4
|
-
export class Migrate implements MigrationInterface {
|
5
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
6
|
-
await queryRunner.createTable(
|
7
|
-
new Table({
|
8
|
-
name: 'countries',
|
9
|
-
columns: [
|
10
|
-
idColumn(),
|
11
|
-
{
|
12
|
-
name: 'code',
|
13
|
-
type: 'char',
|
14
|
-
length: '3',
|
15
|
-
isNullable: false,
|
16
|
-
},
|
17
|
-
timestampColumn(),
|
18
|
-
timestampColumn('updated_at'),
|
19
|
-
],
|
20
|
-
}),
|
21
|
-
true,
|
22
|
-
);
|
23
|
-
|
24
|
-
await queryRunner.createTable(
|
25
|
-
new Table({
|
26
|
-
name: 'locales',
|
27
|
-
columns: [
|
28
|
-
idColumn(),
|
29
|
-
{
|
30
|
-
name: 'code',
|
31
|
-
type: 'char',
|
32
|
-
length: '2',
|
33
|
-
isNullable: false,
|
34
|
-
},
|
35
|
-
{
|
36
|
-
name: 'region',
|
37
|
-
type: 'char',
|
38
|
-
length: '2',
|
39
|
-
isNullable: false,
|
40
|
-
},
|
41
|
-
{
|
42
|
-
name: 'enabled',
|
43
|
-
type: 'boolean',
|
44
|
-
default: true,
|
45
|
-
},
|
46
|
-
timestampColumn(),
|
47
|
-
timestampColumn('updated_at'),
|
48
|
-
],
|
49
|
-
}),
|
50
|
-
);
|
51
|
-
|
52
|
-
await queryRunner.createTable(
|
53
|
-
new Table({
|
54
|
-
name: 'country_translations',
|
55
|
-
columns: [
|
56
|
-
foreignColumn({ name: 'country_id', isPrimary: true }),
|
57
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
58
|
-
{
|
59
|
-
name: 'name',
|
60
|
-
type: 'varchar',
|
61
|
-
},
|
62
|
-
timestampColumn(),
|
63
|
-
timestampColumn('updated_at'),
|
64
|
-
],
|
65
|
-
foreignKeys: [
|
66
|
-
{
|
67
|
-
columnNames: ['country_id'],
|
68
|
-
referencedColumnNames: ['id'],
|
69
|
-
referencedTableName: 'countries',
|
70
|
-
onDelete: 'CASCADE',
|
71
|
-
},
|
72
|
-
{
|
73
|
-
columnNames: ['locale_id'],
|
74
|
-
referencedColumnNames: ['id'],
|
75
|
-
referencedTableName: 'locales',
|
76
|
-
onDelete: 'CASCADE',
|
77
|
-
},
|
78
|
-
],
|
79
|
-
}),
|
80
|
-
);
|
81
|
-
}
|
82
|
-
|
83
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
84
|
-
await queryRunner.dropTable('locales');
|
85
|
-
}
|
86
|
-
}
|
@@ -1,77 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
MigrationInterface,
|
3
|
-
QueryRunner,
|
4
|
-
Table,
|
5
|
-
TableForeignKey,
|
6
|
-
} from 'typeorm';
|
7
|
-
import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
11
|
-
await await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'translation_namespaces',
|
14
|
-
columns: [
|
15
|
-
idColumn(),
|
16
|
-
{
|
17
|
-
name: 'name',
|
18
|
-
type: 'varchar',
|
19
|
-
isNullable: false,
|
20
|
-
},
|
21
|
-
timestampColumn(),
|
22
|
-
timestampColumn('updated_at'),
|
23
|
-
],
|
24
|
-
}),
|
25
|
-
true,
|
26
|
-
);
|
27
|
-
|
28
|
-
await queryRunner.createTable(
|
29
|
-
new Table({
|
30
|
-
name: 'translations',
|
31
|
-
columns: [
|
32
|
-
idColumn(),
|
33
|
-
foreignColumn({ name: 'locale_id' }),
|
34
|
-
foreignColumn({ name: 'namespace_id' }),
|
35
|
-
{
|
36
|
-
name: 'name',
|
37
|
-
type: 'varchar',
|
38
|
-
isNullable: false,
|
39
|
-
},
|
40
|
-
{
|
41
|
-
name: 'value',
|
42
|
-
type: 'varchar',
|
43
|
-
isNullable: false,
|
44
|
-
},
|
45
|
-
timestampColumn(),
|
46
|
-
timestampColumn('updated_at'),
|
47
|
-
],
|
48
|
-
indices: [
|
49
|
-
{
|
50
|
-
columnNames: ['locale_id', 'namespace_id', 'name'],
|
51
|
-
isUnique: true,
|
52
|
-
},
|
53
|
-
],
|
54
|
-
foreignKeys: [
|
55
|
-
new TableForeignKey({
|
56
|
-
columnNames: ['locale_id'],
|
57
|
-
referencedTableName: 'locales',
|
58
|
-
referencedColumnNames: ['id'],
|
59
|
-
onDelete: 'CASCADE',
|
60
|
-
}),
|
61
|
-
new TableForeignKey({
|
62
|
-
columnNames: ['namespace_id'],
|
63
|
-
referencedTableName: 'translation_namespaces',
|
64
|
-
referencedColumnNames: ['id'],
|
65
|
-
onDelete: 'CASCADE',
|
66
|
-
}),
|
67
|
-
],
|
68
|
-
}),
|
69
|
-
true,
|
70
|
-
);
|
71
|
-
}
|
72
|
-
|
73
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
74
|
-
await queryRunner.dropTable('translations');
|
75
|
-
await queryRunner.dropTable('translation_namespaces');
|
76
|
-
}
|
77
|
-
}
|