joeldg / bowhead

PHP trading bot framework
Apache License 2.0
801 stars 288 forks source link

Error seeding db #77

Closed aldasa closed 6 years ago

aldasa commented 6 years ago

Migration works fine:

php artisan migrate
Migration table created successfully.
Migrating: 2018_01_03_171946_create_bh_configs_table
Migrated:  2018_01_03_171946_create_bh_configs_table
Migrating: 2018_01_03_171946_create_bh_exchange_accounts_table
Migrated:  2018_01_03_171946_create_bh_exchange_accounts_table
Migrating: 2018_01_03_171946_create_bh_exchange_addresses_table
Migrated:  2018_01_03_171946_create_bh_exchange_addresses_table
Migrating: 2018_01_03_171946_create_bh_exchange_balances_table
Migrated:  2018_01_03_171946_create_bh_exchange_balances_table
Migrating: 2018_01_03_171946_create_bh_exchange_pairs_table
Migrated:  2018_01_03_171946_create_bh_exchange_pairs_table
Migrating: 2018_01_03_171946_create_bh_exchanges_table
Migrated:  2018_01_03_171946_create_bh_exchanges_table
Migrating: 2018_01_03_171946_create_bh_ohlcvs_table
Migrated:  2018_01_03_171946_create_bh_ohlcvs_table
Migrating: 2018_01_03_171946_create_bh_tickers_table
Migrated:  2018_01_03_171946_create_bh_tickers_table
Migrating: 2018_01_04_024507_create_bh_popular_exchanges_table
Migrated:  2018_01_04_024507_create_bh_popular_exchanges_table

Fails seeding

php artisan db:seed
Seeding: BhExchangesTableSeeder
Seeding: BhExchangePairsTableSeeder
Seeding: BhConfigsTableSeeder
Seeding: BhOhlcvsTableSeeder
Seeding: BhTickersTableSeeder
Seeding: BhPopularExchangesTableSeeder

In Container.php line 729:

Class BhPopularExchangesTableSeeder does not exist

php artisan db:seed --class=BhPopularExchangesTableSeeder
In Container.php line 729:
Class BhPopularExchangesTableSeederr does not exist

The BhPopularExchangesTableSeeder.php file is present in database/seeds

rxmg-joeldg commented 6 years ago

you may want to:

php artisan config:clear php artisan migrate:refresh (if this fails, wipe the bh_* tables and just remove the migration table for now and then re-run) php artisan db:seed

itskeKs commented 6 years ago

@aldasa can you pls tell how you managed to migrate? @rxmg-joeldg for me it only migrates the first file from the migrations folder. any ideas?

rxmg-joeldg commented 6 years ago

Let me try here... completely new DB

joeldg@Joels-MacBook-Pro-2 ~/Projects/bowhead (master) $ git pull
Already up-to-date

Nothing in git status that would change anything.. Running composer update updated a couple things, but nothing major.

joeldg@Joels-MacBook-Pro-2 ~/Projects/bowhead (master) $ php artisan migrate:refresh
Migration table not found.
Migration table created successfully.
Migrating: 2018_01_03_171946_create_bh_configs_table
Migrated:  2018_01_03_171946_create_bh_configs_table
Migrating: 2018_01_03_171946_create_bh_exchange_accounts_table
Migrated:  2018_01_03_171946_create_bh_exchange_accounts_table
Migrating: 2018_01_03_171946_create_bh_exchange_addresses_table
Migrated:  2018_01_03_171946_create_bh_exchange_addresses_table
Migrating: 2018_01_03_171946_create_bh_exchange_balances_table
Migrated:  2018_01_03_171946_create_bh_exchange_balances_table
Migrating: 2018_01_03_171946_create_bh_exchange_pairs_table
Migrated:  2018_01_03_171946_create_bh_exchange_pairs_table
Migrating: 2018_01_03_171946_create_bh_exchanges_table
Migrated:  2018_01_03_171946_create_bh_exchanges_table
Migrating: 2018_01_03_171946_create_bh_ohlcvs_table
Migrated:  2018_01_03_171946_create_bh_ohlcvs_table
Migrating: 2018_01_03_171946_create_bh_tickers_table
Migrated:  2018_01_03_171946_create_bh_tickers_table
Migrating: 2018_01_04_024507_create_bh_popular_exchanges_table
Migrated:  2018_01_04_024507_create_bh_popular_exchanges_table

joeldg@Joels-MacBook-Pro-2 ~/Projects/bowhead (master) $ php artisan db:seed
Seeding: BhExchangesTableSeeder
Seeding: BhExchangePairsTableSeeder
Seeding: BhConfigsTableSeeder
Seeding: BhOhlcvsTableSeeder
Seeding: BhTickersTableSeeder
Seeding: BhPopularExchangesTableSeeder
joeldg@Joels-MacBook-Pro-2 ~/Projects/bowhead (master) $

Do you have more info on what is going on?

rxmg-joeldg commented 6 years ago

I def want to know if there is any issue with this as it is a core feature of what I am working right now, which is to refocus Bowhead from "currency" (forex+crypto) on to be able to move money around between exchanges rapidly with an algorithm I worked up for fastest path based on network speed of coins i.e. Dash and Ripple are clearly faster than ETH and MUCH faster than BTC, this is interesting for a few applications because you can match exchanges where you can say take BTC transform it into XRP->shoot it to the next exchange->transform the XRP back into BTC ... and so on..
Anyway Please do a fresh pull, fresh db and let me know if it is still happening.. and if so, please provide your PHP version (php -v) and maybe even the output of php -i

itskeKs commented 6 years ago

/var/www/bowhead$ php artisan migrate:refresh Nothing to rollback.

In Connection.php line 647:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table bh_exchange_acco unts add index exch_name(exch_name))

In PDOStatement.php line 107:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

In PDOStatement.php line 105:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

:/var/www/bowhead$ nano .env :/var/www/bowhead$ php artisan migrate:status +------+------------------------------------------------------+ | Ran? | Migration | +------+------------------------------------------------------+ | Y | 2018_01_03_171946_create_bh_configs_table | | N | 2018_01_03_171946_create_bh_exchange_accounts_table | | N | 2018_01_03_171946_create_bh_exchange_addresses_table | | N | 2018_01_03_171946_create_bh_exchange_balances_table | | N | 2018_01_03_171946_create_bh_exchange_pairs_table | | N | 2018_01_03_171946_create_bh_exchanges_table | | N | 2018_01_03_171946_create_bh_ohlcvs_table | | N | 2018_01_03_171946_create_bh_tickers_table | | N | 2018_01_04_024507_create_bh_popular_exchanges_table | +------+------------------------------------------------------+

there is my error. it migrates the first table but the rest doesnt seem to work. if i remove each php file after migration it then works but seems not run properly. streaming.py also want an accountID. but where to add this one? :)

btw. i am still at part 1 so forgive me if thats explained later.

itskeKs commented 6 years ago

@rxmg-joeldg btw. i am running this on debian 9.3 with newest mariaDB but that should nit be the problem i guess since ist the same as mysql.

will try to run it locally on my mac. will let you know if that worked.

edit: how i freaking hate brew :D thats not my case to use. so running into a lot of troubles there since my php is not linking how it supposed to link. giving up on that side.

aldasa commented 6 years ago

I dropped the db, and cloned the project again. Migrated & Seeded first time.

itskeKs commented 6 years ago

also dropped it a couple of times but same same

itskeKs commented 6 years ago

does the db user have to be root?

edit: tried with root also the same.

did config:clear then migrate:refresh then this (hmm maybe write acces but i granted everything within mysql): php artisan migrate:refresh Rolling back: 2018_01_03_171946_create_bh_configs_table Rolled back: 2018_01_03_171946_create_bh_configs_table

In Connection.php line 647:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'bh_exchange_accounts' already exists (SQL: create table bh_exchange_accounts (id int unsigned not null auto_increment primary key, auth_id int null, exch_name varchar(255) null, exch_id int null, auth_key varchar(255)
null, auth_secret varchar(255) null, auth_optional1 varchar(255) null, auth_nickname varchar(255) null, auth_updated varchar(255) null, au th_active tinyint(1) null, auth_trade tinyint(1) null, exch_trade_enabled tinyint(1) null, created_at timestamp null, updated_at timestamp
null, deleted_at timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)

In PDOStatement.php line 107:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'bh_exchange_accounts' already exists

In PDOStatement.php line 105:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'bh_exchange_accounts' already exists

aldasa commented 6 years ago

Might be your character set making the db key too long?

https://stackoverflow.com/q/42244541/5262010

itskeKs commented 6 years ago

@aldasa bro that did the trick. THANKS A LOT 👍

itskeKs commented 6 years ago

@aldasa any chance with helping me out for the streaming.py "AccountID" issue? i added everything to .env but seems like oandawrapper gets its api-login-data from somewhere else?!

rxmg-joeldg commented 6 years ago

I also made a code change so others won't hit this issue listed here https://laravel-news.com/laravel-5-4-key-too-long-error

Added Schema::defaultStringLength(191);