@hedhog/admin 0.0.80 → 0.0.82
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 +491 -2
- 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
@@ -1035,10 +1035,12 @@ data:
|
|
1035
1035
|
users:
|
1036
1036
|
- name: Administrator
|
1037
1037
|
email: root@hedhog.com
|
1038
|
-
password:
|
1038
|
+
password:
|
1039
|
+
hash: changeme
|
1039
1040
|
- name: User
|
1040
1041
|
email: user@hedhog.com
|
1041
|
-
password:
|
1042
|
+
password:
|
1043
|
+
hash: changeme
|
1042
1044
|
roles:
|
1043
1045
|
- slug: admin
|
1044
1046
|
name:
|
@@ -1315,3 +1317,490 @@ data:
|
|
1315
1317
|
en: The font to use
|
1316
1318
|
pt: A fonte a utilizar
|
1317
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
|
+
locales:
|
1333
|
+
columns:
|
1334
|
+
- type: pk
|
1335
|
+
- name: code
|
1336
|
+
type: char
|
1337
|
+
length: 2
|
1338
|
+
- name: region
|
1339
|
+
type: char
|
1340
|
+
length: 2
|
1341
|
+
- name: enabled
|
1342
|
+
type: boolean
|
1343
|
+
default: true
|
1344
|
+
- type: created_at
|
1345
|
+
- type: updated_at
|
1346
|
+
ifNotExists: true
|
1347
|
+
|
1348
|
+
country_translations:
|
1349
|
+
columns:
|
1350
|
+
- name: country_id
|
1351
|
+
type: fk
|
1352
|
+
isPrimary: true
|
1353
|
+
references:
|
1354
|
+
table: countries
|
1355
|
+
column: id
|
1356
|
+
onDelete: CASCADE
|
1357
|
+
- name: locale_id
|
1358
|
+
isPrimary: true
|
1359
|
+
references:
|
1360
|
+
table: locales
|
1361
|
+
column: id
|
1362
|
+
onDelete: CASCADE
|
1363
|
+
- name: name
|
1364
|
+
- type: created_at
|
1365
|
+
- type: updated_at
|
1366
|
+
ifNotExists: true
|
1367
|
+
|
1368
|
+
translation_namespaces:
|
1369
|
+
columns:
|
1370
|
+
- type: pk
|
1371
|
+
- name: name
|
1372
|
+
- type: created_at
|
1373
|
+
- type: updated_at
|
1374
|
+
ifNotExists: true
|
1375
|
+
|
1376
|
+
translations:
|
1377
|
+
columns:
|
1378
|
+
- type: pk
|
1379
|
+
- name: locale_id
|
1380
|
+
type: fk
|
1381
|
+
references:
|
1382
|
+
table: locales
|
1383
|
+
column: id
|
1384
|
+
onDelete: CASCADE
|
1385
|
+
- name: namespace_id
|
1386
|
+
type: fk
|
1387
|
+
references:
|
1388
|
+
table: translation_namespaces
|
1389
|
+
column: id
|
1390
|
+
onDelete: CASCADE
|
1391
|
+
- name: name
|
1392
|
+
- name: value
|
1393
|
+
- type: created_at
|
1394
|
+
- type: updated_at
|
1395
|
+
indices:
|
1396
|
+
- columns:
|
1397
|
+
- locale_id
|
1398
|
+
- namespace_id
|
1399
|
+
- name
|
1400
|
+
isUnique: true
|
1401
|
+
ifNotExists: true
|
1402
|
+
|
1403
|
+
multifactors:
|
1404
|
+
columns:
|
1405
|
+
- type: pk
|
1406
|
+
- type: slug
|
1407
|
+
- type: created_at
|
1408
|
+
- type: updated_at
|
1409
|
+
ifNotExists: true
|
1410
|
+
|
1411
|
+
multifactor_translations:
|
1412
|
+
columns:
|
1413
|
+
- name: multifactor_id
|
1414
|
+
type: fk
|
1415
|
+
isPrimary: true
|
1416
|
+
references:
|
1417
|
+
table: multifactors
|
1418
|
+
column: id
|
1419
|
+
onDelete: CASCADE
|
1420
|
+
- name: locale_id
|
1421
|
+
type: fk
|
1422
|
+
isPrimary: true
|
1423
|
+
references:
|
1424
|
+
table: locales
|
1425
|
+
column: id
|
1426
|
+
onDelete: CASCADE
|
1427
|
+
- name: name
|
1428
|
+
- type: created_at
|
1429
|
+
- type: updated_at
|
1430
|
+
ifNotExists: true
|
1431
|
+
|
1432
|
+
users:
|
1433
|
+
columns:
|
1434
|
+
- type: pk
|
1435
|
+
- name: multifactor_id
|
1436
|
+
type: fk
|
1437
|
+
isNullable: true
|
1438
|
+
references:
|
1439
|
+
table: multifactors
|
1440
|
+
column: id
|
1441
|
+
onDelete: SET NULL
|
1442
|
+
- name: name
|
1443
|
+
- name: email
|
1444
|
+
- name: password
|
1445
|
+
- name: code
|
1446
|
+
isNullable: true
|
1447
|
+
- type: created_at
|
1448
|
+
- type: updated_at
|
1449
|
+
ifNotExists: true
|
1450
|
+
|
1451
|
+
screens:
|
1452
|
+
columns:
|
1453
|
+
- type: pk
|
1454
|
+
- type: slug
|
1455
|
+
- name: icon
|
1456
|
+
isNullable: true
|
1457
|
+
- type: created_at
|
1458
|
+
- type: updated_at
|
1459
|
+
ifNotExists: true
|
1460
|
+
|
1461
|
+
screen_translations:
|
1462
|
+
columns:
|
1463
|
+
- name: screen_id
|
1464
|
+
type: fk
|
1465
|
+
isPrimary: true
|
1466
|
+
references:
|
1467
|
+
table: screens
|
1468
|
+
column: id
|
1469
|
+
onDelete: CASCADE
|
1470
|
+
- name: locale_id
|
1471
|
+
type: fk
|
1472
|
+
isPrimary: true
|
1473
|
+
references:
|
1474
|
+
table: locales
|
1475
|
+
column: id
|
1476
|
+
onDelete: CASCADE
|
1477
|
+
- name: name
|
1478
|
+
- name: description
|
1479
|
+
- type: created_at
|
1480
|
+
- type: updated_at
|
1481
|
+
ifNotExists: true
|
1482
|
+
|
1483
|
+
menus:
|
1484
|
+
columns:
|
1485
|
+
- type: pk
|
1486
|
+
- name: menu_id
|
1487
|
+
type: fk
|
1488
|
+
isNullable: true
|
1489
|
+
references:
|
1490
|
+
table: menus
|
1491
|
+
column: id
|
1492
|
+
onDelete: CASCADE
|
1493
|
+
- type: slug
|
1494
|
+
- name: url
|
1495
|
+
isNullable: true
|
1496
|
+
- name: order
|
1497
|
+
type: int
|
1498
|
+
default: 0
|
1499
|
+
unsigned: true
|
1500
|
+
- name: icon
|
1501
|
+
isNullable: true
|
1502
|
+
- type: created_at
|
1503
|
+
- type: updated_at
|
1504
|
+
ifNotExists: true
|
1505
|
+
|
1506
|
+
menu_translations:
|
1507
|
+
columns:
|
1508
|
+
- name: menu_id
|
1509
|
+
type: fk
|
1510
|
+
isPrimary: true
|
1511
|
+
references:
|
1512
|
+
table: menus
|
1513
|
+
column: id
|
1514
|
+
onDelete: CASCADE
|
1515
|
+
- name: locale_id
|
1516
|
+
type: fk
|
1517
|
+
isPrimary: true
|
1518
|
+
references:
|
1519
|
+
table: locales
|
1520
|
+
column: id
|
1521
|
+
onDelete: CASCADE
|
1522
|
+
- name: name
|
1523
|
+
- type: created_at
|
1524
|
+
- type: updated_at
|
1525
|
+
ifNotExists: true
|
1526
|
+
|
1527
|
+
menu_screens:
|
1528
|
+
columns:
|
1529
|
+
- name: menu_id
|
1530
|
+
type: fk
|
1531
|
+
isPrimary: true
|
1532
|
+
references:
|
1533
|
+
table: menus
|
1534
|
+
column: id
|
1535
|
+
onDelete: CASCADE
|
1536
|
+
- name: screen_id
|
1537
|
+
type: fk
|
1538
|
+
isPrimary: true
|
1539
|
+
references:
|
1540
|
+
table: screens
|
1541
|
+
column: id
|
1542
|
+
onDelete: CASCADE
|
1543
|
+
ifNotExists: true
|
1544
|
+
|
1545
|
+
routes:
|
1546
|
+
columns:
|
1547
|
+
- type: pk
|
1548
|
+
- name: url
|
1549
|
+
- name: method
|
1550
|
+
type: enum
|
1551
|
+
enum:
|
1552
|
+
- GET
|
1553
|
+
- POST
|
1554
|
+
- PATCH
|
1555
|
+
- DELETE
|
1556
|
+
- PUT
|
1557
|
+
- OPTIONS
|
1558
|
+
- HEAD
|
1559
|
+
- type: created_at
|
1560
|
+
- type: updated_at
|
1561
|
+
indices:
|
1562
|
+
- columns: ['url', 'method']
|
1563
|
+
isUnique: true
|
1564
|
+
ifNotExists: true
|
1565
|
+
|
1566
|
+
roles:
|
1567
|
+
columns:
|
1568
|
+
- type: pk
|
1569
|
+
- type: slug
|
1570
|
+
- type: created_at
|
1571
|
+
- type: updated_at
|
1572
|
+
ifNotExists: true
|
1573
|
+
|
1574
|
+
role_translations:
|
1575
|
+
columns:
|
1576
|
+
- name: role_id
|
1577
|
+
type: fk
|
1578
|
+
isPrimary: true
|
1579
|
+
references:
|
1580
|
+
table: roles
|
1581
|
+
column: id
|
1582
|
+
onDelete: CASCADE
|
1583
|
+
- name: locale_id
|
1584
|
+
type: fk
|
1585
|
+
isPrimary: true
|
1586
|
+
references:
|
1587
|
+
table: locales
|
1588
|
+
column: id
|
1589
|
+
onDelete: CASCADE
|
1590
|
+
- name: name
|
1591
|
+
- name: description
|
1592
|
+
- type: created_at
|
1593
|
+
- type: updated_at
|
1594
|
+
ifNotExists: true
|
1595
|
+
|
1596
|
+
role_menus:
|
1597
|
+
columns:
|
1598
|
+
- name: role_id
|
1599
|
+
type: fk
|
1600
|
+
isPrimary: true
|
1601
|
+
references:
|
1602
|
+
table: roles
|
1603
|
+
column: id
|
1604
|
+
onDelete: CASCADE
|
1605
|
+
- name: menu_id
|
1606
|
+
type: fk
|
1607
|
+
isPrimary: true
|
1608
|
+
references:
|
1609
|
+
table: menus
|
1610
|
+
column: id
|
1611
|
+
onDelete: CASCADE
|
1612
|
+
- type: created_at
|
1613
|
+
- type: updated_at
|
1614
|
+
ifNotExists: true
|
1615
|
+
|
1616
|
+
route_screens:
|
1617
|
+
columns:
|
1618
|
+
- name: route_id
|
1619
|
+
type: fk
|
1620
|
+
isPrimary: true
|
1621
|
+
references:
|
1622
|
+
table: routes
|
1623
|
+
column: id
|
1624
|
+
onDelete: CASCADE
|
1625
|
+
- name: screen_id
|
1626
|
+
type: fk
|
1627
|
+
isPrimary: true
|
1628
|
+
references:
|
1629
|
+
table: screens
|
1630
|
+
column: id
|
1631
|
+
onDelete: CASCADE
|
1632
|
+
- type: created_at
|
1633
|
+
- type: updated_at
|
1634
|
+
ifNotExists: true
|
1635
|
+
|
1636
|
+
role_screens:
|
1637
|
+
columns:
|
1638
|
+
- name: role_id
|
1639
|
+
type: fk
|
1640
|
+
isPrimary: true
|
1641
|
+
references:
|
1642
|
+
table: roles
|
1643
|
+
column: id
|
1644
|
+
onDelete: CASCADE
|
1645
|
+
- name: screen_id
|
1646
|
+
type: fk
|
1647
|
+
isPrimary: true
|
1648
|
+
references:
|
1649
|
+
table: screens
|
1650
|
+
column: id
|
1651
|
+
onDelete: CASCADE
|
1652
|
+
- type: created_at
|
1653
|
+
- type: updated_at
|
1654
|
+
ifNotExists: true
|
1655
|
+
|
1656
|
+
role_users:
|
1657
|
+
columns:
|
1658
|
+
- name: role_id
|
1659
|
+
type: fk
|
1660
|
+
isPrimary: true
|
1661
|
+
references:
|
1662
|
+
table: roles
|
1663
|
+
column: id
|
1664
|
+
onDelete: CASCADE
|
1665
|
+
- name: user_id
|
1666
|
+
type: fk
|
1667
|
+
isPrimary: true
|
1668
|
+
references:
|
1669
|
+
table: users
|
1670
|
+
column: id
|
1671
|
+
onDelete: CASCADE
|
1672
|
+
- type: created_at
|
1673
|
+
- type: updated_at
|
1674
|
+
ifNotExists: true
|
1675
|
+
|
1676
|
+
role_routes:
|
1677
|
+
columns:
|
1678
|
+
- name: role_id
|
1679
|
+
type: fk
|
1680
|
+
isPrimary: true
|
1681
|
+
references:
|
1682
|
+
table: roles
|
1683
|
+
column: id
|
1684
|
+
onDelete: CASCADE
|
1685
|
+
- name: route_id
|
1686
|
+
type: fk
|
1687
|
+
isPrimary: true
|
1688
|
+
references:
|
1689
|
+
table: routes
|
1690
|
+
column: id
|
1691
|
+
onDelete: CASCADE
|
1692
|
+
- type: created_at
|
1693
|
+
- type: updated_at
|
1694
|
+
ifNotExists: true
|
1695
|
+
|
1696
|
+
setting_groups:
|
1697
|
+
columns:
|
1698
|
+
- type: pk
|
1699
|
+
- name: icon
|
1700
|
+
length: 31
|
1701
|
+
- type: slug
|
1702
|
+
- type: created_at
|
1703
|
+
- type: updated_at
|
1704
|
+
ifNotExists: true
|
1705
|
+
|
1706
|
+
setting_group_translations:
|
1707
|
+
columns:
|
1708
|
+
- name: locale_id
|
1709
|
+
type: fk
|
1710
|
+
isPrimary: true
|
1711
|
+
references:
|
1712
|
+
table: locales
|
1713
|
+
column: id
|
1714
|
+
onDelete: CASCADE
|
1715
|
+
- name: group_id
|
1716
|
+
type: fk
|
1717
|
+
isPrimary: true
|
1718
|
+
references:
|
1719
|
+
table: setting_groups
|
1720
|
+
column: id
|
1721
|
+
onDelete: CASCADE
|
1722
|
+
- name: name
|
1723
|
+
length: 63
|
1724
|
+
- name: description
|
1725
|
+
length: 255
|
1726
|
+
isNullable: true
|
1727
|
+
- type: created_at
|
1728
|
+
- type: updated_at
|
1729
|
+
ifNotExists: true
|
1730
|
+
|
1731
|
+
settings:
|
1732
|
+
columns:
|
1733
|
+
- type: pk
|
1734
|
+
- name: group_id
|
1735
|
+
type: fk
|
1736
|
+
references:
|
1737
|
+
table: setting_groups
|
1738
|
+
column: id
|
1739
|
+
onDelete: CASCADE
|
1740
|
+
- type: slug
|
1741
|
+
- name: type
|
1742
|
+
type: enum
|
1743
|
+
enum:
|
1744
|
+
- string
|
1745
|
+
- number
|
1746
|
+
- boolean
|
1747
|
+
- json
|
1748
|
+
default: string
|
1749
|
+
- name: value
|
1750
|
+
length: 1023
|
1751
|
+
isNullable: true
|
1752
|
+
- name: userOverride
|
1753
|
+
type: boolean
|
1754
|
+
default: false
|
1755
|
+
- type: created_at
|
1756
|
+
- type: updated_at
|
1757
|
+
ifNotExists: true
|
1758
|
+
|
1759
|
+
setting_translations:
|
1760
|
+
columns:
|
1761
|
+
- name: locale_id
|
1762
|
+
type: fk
|
1763
|
+
isPrimary: true
|
1764
|
+
references:
|
1765
|
+
table: locales
|
1766
|
+
column: id
|
1767
|
+
onDelete: CASCADE
|
1768
|
+
- name: setting_id
|
1769
|
+
type: fk
|
1770
|
+
isPrimary: true
|
1771
|
+
references:
|
1772
|
+
table: settings
|
1773
|
+
column: id
|
1774
|
+
onDelete: CASCADE
|
1775
|
+
- name: description
|
1776
|
+
length: 255
|
1777
|
+
isNullable: true
|
1778
|
+
- name: name
|
1779
|
+
length: 63
|
1780
|
+
isNullable: true
|
1781
|
+
- type: created_at
|
1782
|
+
- type: updated_at
|
1783
|
+
ifNotExists: true
|
1784
|
+
|
1785
|
+
setting_users:
|
1786
|
+
columns:
|
1787
|
+
- name: user_id
|
1788
|
+
type: fk
|
1789
|
+
isPrimary: true
|
1790
|
+
references:
|
1791
|
+
table: users
|
1792
|
+
column: id
|
1793
|
+
onDelete: CASCADE
|
1794
|
+
- name: setting_id
|
1795
|
+
type: fk
|
1796
|
+
isPrimary: true
|
1797
|
+
references:
|
1798
|
+
table: settings
|
1799
|
+
column: id
|
1800
|
+
onDelete: CASCADE
|
1801
|
+
- name: value
|
1802
|
+
length: 1023
|
1803
|
+
isNullable: 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
|
-
}
|