
    create table Account (
        id bigint not null auto_increment,
        accountDesc varchar(255),
        accountName varchar(255) not null,
        accountNumber varchar(255),
        primary key (id),
        unique (accountName)
    ) type=InnoDB;

    create table Tag (
        id bigint not null auto_increment,
        tagName varchar(255) not null,
        primary key (id),
        unique (tagName)
    ) type=InnoDB;

    create table Transaction (
        id bigint not null auto_increment,
        transactionAmount double precision not null,
        transactionDate datetime not null,
        transactionDesc varchar(255) not null,
        transactionType integer not null,
        account_id bigint not null,
        parent_id bigint,
        primary key (id)
    ) type=InnoDB;

    create table Transaction_Tag (
        transactions_id bigint not null,
        tags_id bigint not null,
        primary key (transactions_id, tags_id)
    ) type=InnoDB;

    alter table Transaction 
        add index FKE30A7ABE58265184 (account_id), 
        add constraint FKE30A7ABE58265184 
        foreign key (account_id) 
        references Account (id);

    alter table Transaction 
        add index FKE30A7ABEF7B8A998 (parent_id), 
        add constraint FKE30A7ABEF7B8A998 
        foreign key (parent_id) 
        references Transaction (id);

    alter table Transaction_Tag 
        add index FKFDF6279B3FE8A85 (tags_id), 
        add constraint FKFDF6279B3FE8A85 
        foreign key (tags_id) 
        references Tag (id);

    alter table Transaction_Tag 
        add index FKFDF6279C7A7E50D (transactions_id), 
        add constraint FKFDF6279C7A7E50D 
        foreign key (transactions_id) 
        references Transaction (id);
