Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compability to SQLite support #3812

Open
useAnder opened this issue Feb 28, 2024 · 0 comments
Open

Compability to SQLite support #3812

useAnder opened this issue Feb 28, 2024 · 0 comments

Comments

@useAnder
Copy link

There is a proposal to make WordPress SQLite compatible. lets-make-wordpress-officially-support-sqlite

Im using in some sites and it works very well. But Redirection doesnt setup automatically.

The sql statements doesnt run in SQLite because the difference in syntax.

With the help of ChatGPT I converted as following and it is working.

CREATE TABLE IF NOT EXISTS wp_redirection_items(idINTEGER PRIMARY KEY,urlTEXT NOT NULL,match_urlVARCHAR(2000),match_dataTEXT,regexINTEGER NOT NULL DEFAULT 0,positionINTEGER NOT NULL DEFAULT 0,last_countINTEGER NOT NULL DEFAULT 0,last_accessTEXT NOT NULL DEFAULT '1970-01-01 00:00:00',group_idINTEGER NOT NULL DEFAULT 0,statusTEXT NOT NULL DEFAULT 'enabled',action_typeVARCHAR(20) NOT NULL,action_codeINTEGER NOT NULL,action_dataTEXT,match_typeVARCHAR(20) NOT NULL,title TEXT, FOREIGN KEY (group_id) REFERENCES wp_redirection_groups(id`)
);

CREATE TABLE IF NOT EXISTS wp_redirection_groups (
id INTEGER PRIMARY KEY,
name VARCHAR(50) NOT NULL,
tracking INTEGER NOT NULL DEFAULT 1,
module_id INTEGER NOT NULL DEFAULT 0,
status TEXT NOT NULL DEFAULT 'enabled',
position INTEGER NOT NULL DEFAULT 0
);

CREATE TABLE IF NOT EXISTS wp_redirection_logs (
id INTEGER PRIMARY KEY,
created TEXT NOT NULL,
url TEXT NOT NULL,
domain VARCHAR(255),
sent_to TEXT,
agent TEXT,
referrer TEXT,
http_code INTEGER NOT NULL DEFAULT 0,
request_method VARCHAR(10),
request_data TEXT,
redirect_by VARCHAR(50),
redirection_id INTEGER,
ip VARCHAR(45),
FOREIGN KEY (redirection_id) REFERENCES wp_redirection_items(id)
);

CREATE TABLE IF NOT EXISTS wp_redirection_404 (
id INTEGER PRIMARY KEY,
created TEXT NOT NULL,
url TEXT NOT NULL,
domain VARCHAR(255),
agent VARCHAR(255),
referrer VARCHAR(255),
http_code INTEGER NOT NULL DEFAULT 0,
request_method VARCHAR(10),
request_data TEXT,
ip VARCHAR(45)
);
`

If its get merged into core, maybe some adjustments could be made in setup process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants