Fixing bug username not utf8 registered.
This commit is contained in:
parent
4ef5513b5f
commit
be6c2f2201
@ -19,6 +19,9 @@ use DoctorKarma::DB;
|
|||||||
use DoctorKarma::DAO::User;
|
use DoctorKarma::DAO::User;
|
||||||
use DoctorKarma::Model::User;
|
use DoctorKarma::Model::User;
|
||||||
|
|
||||||
|
binmode STDOUT, ':utf8';
|
||||||
|
binmode STDERR, ':utf8';
|
||||||
|
|
||||||
my $config = DoctorKarma::Config->new;
|
my $config = DoctorKarma::Config->new;
|
||||||
my $logger = DoctorKarma::Logger->new;
|
my $logger = DoctorKarma::Logger->new;
|
||||||
my $telegram =
|
my $telegram =
|
||||||
|
@ -25,12 +25,25 @@ my @migrations = (
|
|||||||
)',
|
)',
|
||||||
'ALTER TABLE users
|
'ALTER TABLE users
|
||||||
ADD COLUMN first_name TEXT',
|
ADD COLUMN first_name TEXT',
|
||||||
|
'CREATE TABLE items (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
word TEXT
|
||||||
|
)',
|
||||||
|
'CREATE TABLE inventory (
|
||||||
|
id_user INTEGER NOT NULL,
|
||||||
|
id_item INTEGER NOT NULL,
|
||||||
|
quantity INTEGER,
|
||||||
|
PRIMARY KEY (id_user, id_item),
|
||||||
|
FOREIGN KEY (id_user) REFERENCES users (id),
|
||||||
|
FOREIGN KEY (id_item) REFERENCES items (id)
|
||||||
|
)'
|
||||||
);
|
);
|
||||||
|
|
||||||
sub dbh {
|
sub dbh {
|
||||||
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", '', '' , {
|
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", '', '' , {
|
||||||
AutoCommit => 1,
|
AutoCommit => 1,
|
||||||
RaiseError => 1,
|
RaiseError => 1,
|
||||||
|
sqlite_unicode => 1,
|
||||||
});
|
});
|
||||||
state $migrations_run = 0;
|
state $migrations_run = 0;
|
||||||
if (!$migrations_run) {
|
if (!$migrations_run) {
|
||||||
|
@ -62,8 +62,9 @@ sub _user_agent {
|
|||||||
my $ua = $self->_user_agent;
|
my $ua = $self->_user_agent;
|
||||||
my $logger = $self->_logger;
|
my $logger = $self->_logger;
|
||||||
my $url = $self->_generate_url( method => $method );
|
my $url = $self->_generate_url( method => $method );
|
||||||
my $response =
|
my $body_response = $ua->post( $url => {} => json => $body )->result->body;
|
||||||
decode_json( $ua->post( $url => {} => json => $body )->result->body );
|
say $body_response;
|
||||||
|
my $response = from_json( $body_response );
|
||||||
|
|
||||||
unless ( $response->{ok} ) {
|
unless ( $response->{ok} ) {
|
||||||
$logger->log_critical( $response->{description} );
|
$logger->log_critical( $response->{description} );
|
||||||
|
127351
lib/DoctorKarma/dictionary
Normal file
127351
lib/DoctorKarma/dictionary
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user