Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gmail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ and also to link your Gmail contacts to your Odoo partners, to create leads from

# Development
Create the database and fill the credentials in `consts.ts`
> psql -U root -d postgres -f init_db.sql
> createdb odoo_gmail_addin
> psql -f init_db.sql odoo_gmail_addin

To serve the addin, you need a public HTTPS connection to your application.
You cannot use nrgok, because Gmail store all images we use in the addin,
Expand Down
17 changes: 11 additions & 6 deletions gmail/init_db.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
CREATE DATABASE odoo_gmail_addin_db;
-- For production:
-- CREATE DATABASE must be run as root (e.g. postgres).
-- This script must be run as a dedicated user (e.g. gmail_addin) which has
-- the rights to create and alter tables.
-- For development:
-- CREATE DATABASE as well as this script can be run as any superuser.
-- Example:
-- createdb odoo_gmail_addin
-- psql -f init_db.sql odoo_gmail_addin
Comment thread
nim-odoo marked this conversation as resolved.

\c odoo_gmail_addin_db;

CREATE TABLE users_settings (
CREATE TABLE IF NOT EXISTS users_settings (
id SERIAL PRIMARY KEY,
email TEXT UNIQUE NOT NULL,
odoo_url TEXT,
Expand All @@ -13,8 +19,7 @@ CREATE TABLE users_settings (
translations_expire_at TIMESTAMP WITH TIME ZONE
);

-- Remember that the user logged the email on the giver record
CREATE TABLE email_logs (
CREATE TABLE IF NOT EXISTS email_logs (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL,
message_id TEXT NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion gmail/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const CLIENT_ID =
// PSQL config
export const PSQL_USER = process.env.PSQL_USER || "root";
export const PSQL_PASS = process.env.PSQL_PASS || "root";
export const PSQL_DB = process.env.PSQL_DB || "odoo_gmail_addin_db";
export const PSQL_DB = process.env.PSQL_DB || "odoo_gmail_addin";
export const PSQL_HOST = process.env.PSQL_HOST || "localhost";
export const PSQL_PORT = Number(process.env.PSQL_PORT || 5432);

Expand Down