Commit fb375ce2 by Owo Sugiana

Perbaikan db schema tasik_kabupaten

1 parent 60ffe639
0.2.1 2020-05-18 0.2.1 2020-05-27
---------------- ----------------
- Tidak perlu lagi tabel bphtb_config karena opsi Invoice ID 16 digit juga - Tidak perlu lagi tabel bphtb_config karena opsi Invoice ID 16 digit juga
tidak ada. tidak ada.
......
...@@ -27,6 +27,10 @@ from .models import ( ...@@ -27,6 +27,10 @@ from .models import (
DBSession = None # override, please DBSession = None # override, please
def get_db_session():
return DBSession
class Common: class Common:
def __init__(self, invoice_id): def __init__(self, invoice_id):
self.invoice_id = invoice_id self.invoice_id = invoice_id
......
...@@ -16,6 +16,7 @@ class Provinsi(Base): ...@@ -16,6 +16,7 @@ class Provinsi(Base):
__tablename__ = 'ref_propinsi' __tablename__ = 'ref_propinsi'
kd_propinsi = Column(String(2), primary_key=True) kd_propinsi = Column(String(2), primary_key=True)
nm_propinsi = Column(String(30), nullable=False) nm_propinsi = Column(String(30), nullable=False)
__table_args__ = dict(schema='bphtb')
class Kabupaten(Base): class Kabupaten(Base):
...@@ -24,6 +25,7 @@ class Kabupaten(Base): ...@@ -24,6 +25,7 @@ class Kabupaten(Base):
String(2), ForeignKey(Provinsi.kd_propinsi), primary_key=True) String(2), ForeignKey(Provinsi.kd_propinsi), primary_key=True)
kd_dati2 = Column(String(2), primary_key=True) kd_dati2 = Column(String(2), primary_key=True)
nm_dati2 = Column(String(30), nullable=False) nm_dati2 = Column(String(30), nullable=False)
__table_args__ = dict(schema='bphtb')
class Kecamatan(Base): class Kecamatan(Base):
...@@ -35,7 +37,8 @@ class Kecamatan(Base): ...@@ -35,7 +37,8 @@ class Kecamatan(Base):
__table_args__ = ( __table_args__ = (
ForeignKeyConstraint([ ForeignKeyConstraint([
kd_propinsi, kd_dati2], kd_propinsi, kd_dati2],
[Kabupaten.kd_propinsi, Kabupaten.kd_dati2]),) [Kabupaten.kd_propinsi, Kabupaten.kd_dati2]),
dict(schema='bphtb'))
class Kelurahan(Base): class Kelurahan(Base):
...@@ -52,4 +55,5 @@ class Kelurahan(Base): ...@@ -52,4 +55,5 @@ class Kelurahan(Base):
ForeignKeyConstraint( ForeignKeyConstraint(
[kd_propinsi, kd_dati2, kd_kecamatan], [kd_propinsi, kd_dati2, kd_kecamatan],
[Kecamatan.kd_propinsi, Kecamatan.kd_dati2, [Kecamatan.kd_propinsi, Kecamatan.kd_dati2,
Kecamatan.kd_kecamatan]),) Kecamatan.kd_kecamatan]),
dict(schema='bphtb'))
...@@ -12,6 +12,10 @@ from .models import ( ...@@ -12,6 +12,10 @@ from .models import (
DBSession = None # override, please DBSession = None # override, please
def get_db_session():
return DBSession
class Inquiry(BaseInquiry): class Inquiry(BaseInquiry):
def get_db_session(self): def get_db_session(self):
return DBSession return DBSession
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!