SebastianJames55 / mind-reader

An app aimed to provide mental support to people who are going through tough times.
https://mind-reader.sebastianjames55.repl.co/api/v1/
MIT License
4 stars 0 forks source link

Create database with the tables #10

Closed SebastianJames55 closed 1 year ago

SebastianJames55 commented 1 year ago

Using #1 create database with the tables.

SebastianJames55 commented 1 year ago

Initial idea was to use SkySQL like in the snoop-stein example. However, after creating account I couldn't find the free tier option. I didn't pursue figuring it out since I wanted to proceed faster. Also, the case is that the free tier is only for 2 weeks. Since the project is aimed for long term and in order to avoid the trouble of migrating to another database in the future, I decided to explore other options.

SebastianJames55 commented 1 year ago

Trying yugabytedb as I had previously worked on a related task. Connected to Yugabyte cloud shell, logged in using admin credentials and created database and tables.

create database demo;

Have to consider creating schema (indicates location of the tables) as well.

create schema new_schema;

In YugabyteDB ysql client, the equivalent of MySQL's SET sql_mode='ANSI_QUOTES' is:

SET standard_conforming_strings = on;

ysql equivalent of

CREATE TABLE chatbot_input (
  id text CHARACTER SET utf8mb4,
  created_at text CHARACTER SET utf8mb4,
  "text" text CHARACTER SET utf8mb4
  );
CREATE TABLE chatbot_input (
    id varchar,
    created_at varchar,   
    "text" varchar  
  );

Connected to the db schema from mindsdb cloud and local. Have to look into whether it's an option to create db, schema & tables in yugabyte from mindsdb (considering from an end-user or quick-user perspective). This will give power of data back to the users.

SebastianJames55 commented 1 year ago

Trying following ysql schema so that id & time can be maintained by the db.

  CREATE TABLE chatbot_input (
       id SERIAL PRIMARY KEY,  
       created_at timestamptz DEFAULT CURRENT_TIMESTAMP,
       text varchar(255)    
  );
SebastianJames55 commented 1 year ago

Output table

CREATE TABLE chatbot_output (
       id SERIAL PRIMARY KEY,  
       created_at timestamptz DEFAULT CURRENT_TIMESTAMP,
       text varchar(1000)    
  );