DokuWiki and SQL code - sql

I recently installed DokuWiki on my domain and ran in one nasty problem.
I am trying to enter such code:
CREATE TABLE LOOM(
ID INT NOT NULL,
KIIP_ID INT NOT NULL,
NIMI VARCHAR(50) NOT NULL,
SYND DATE NOT NULL,
SURM DATE,
PRIMARY KEY (ID));
between tags and if I am trying to preview or save the change, DokuWiki shows me this:
This topic does not exist yet
You've followed a link to a topic that doesn't exist yet. If permissions allow, you may create it by using the Create this page button.
How to fix this?

See http://www.dokuwiki.org/faq:mod_security

You should escape the commands between the <code></code> tags. Like the below.
<code>
CREATE TABLE LOOM(
ID INT NOT NULL,
KIIP_ID INT NOT NULL,
NIMI VARCHAR(50) NOT NULL,
SYND DATE NOT NULL,
SURM DATE,
PRIMARY KEY (ID));
</code>
If you still have problems previewing then Andreas is right it is most likely a web server configuration issue with Apache. To validate that you could redploy on nginx and see if the issue still persists. I have a tutorial about deploying dokuwiki on nginx here: http://bigthinkingapplied.com/launching-a-private-wikipedia-using-dokuwiki/

Related

Can't create graph tables with sqlproj

After getting really fed up with using hierarchyids to manage my node tree, I decided to take a stab at using SQL Server 2017's graph functionality to ease my troubles.
I have a little bit of confusion, though. Currently, all of my SQL scripts are stored and organized in a SQL database project. When I create a node table and publish it to my Azure SQL Database, it only creates a standard table.
However, I can paste the exact same query into SSMS and it creates the graph table just fine. I've included the query below. Am I missing anything obvious?
CREATE TABLE [dbo].[GraphSite]
(
[SiteId] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID(),
[SiteName] NVARCHAR(100) NOT NULL,
[SiteTypeId] UNIQUEIDENTIFIER NOT NULL,
[SiteTimeZone] NVARCHAR(20) NOT NULL DEFAULT N'America/New_York',
[SiteStatusId] UNIQUEIDENTIFIER NULL,
[SiteThemeId] UNIQUEIDENTIFIER NULL,
CONSTRAINT [PK_GraphSite] PRIMARY KEY ([SiteId]),
CONSTRAINT [FK_GraphSite_SiteType] FOREIGN KEY ([SiteTypeId]) REFERENCES [SiteType]([SiteTypeId]),
CONSTRAINT [FK_GraphSite_SiteStatus] FOREIGN KEY ([SiteStatusId]) REFERENCES [SiteStatus]([SiteStatusId]),
CONSTRAINT [FK_GraphSite_SiteTheme] FOREIGN KEY ([SiteThemeId]) REFERENCES [SiteTheme]([SiteThemeId])
) AS NODE;
EDIT: I installed SQL Server 2017 locally and it leaves "AS NODE;" in fine. So SSDT seems to have an issue building graph tables to Microsoft Azure SQL Database v12. Which is weird, considering Azure SQL databases fully support graph tables. Any thoughts?
Could you try downloading the latest version of SSDT from here: https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt
This should fix the problem for you.

Wrong executed SQL Statement error

TL;DR: How do I make the table refresh with the new, updated columns?
Hi, I'm getting an error which states that I have invalid column names. The column names which are invalid have been deleted before hand and updated then.
When I refresh the table's data, the error is displayed again stating: SELECT TOP [1000], Error Source: .Net SqlClient Data Provider and the invalid column names.
The error is straight forward, but how do I manage to change the "default" refresh query of the table? I checked the table from SQL Managment Studio and Visual Studio and everything seems right... it's just that this query is not adapting to the update which I done to the table. This table had a foreign key with another table but I'm sure that I deleted any links with other tables.
Just in case this is the code of the table:
CREATE TABLE [dbo].[Receipt] (
[receiptID] INT IDENTITY (1, 1) NOT NULL,
[employeeUser] NVARCHAR (50) NULL,
[purchasedProductID] INT NULL,
[productName] NVARCHAR (50) NULL,
[clientID] INT NULL,
PRIMARY KEY CLUSTERED ([receiptID] ASC)
);
Thanks alot and take care!
SOLVED
Apparently the "Did you try turning it on/off" method work sometimes...
I restarted my visual studio project and worked.

Generating Liquibase metadata offline

I'm currently experimenting with Liquibase to generate SQL for our database migrations. Due to some constraints within our environment, we need to generate the SQL "offline" and then have that executed against the target database(s) by a DBA.
I've been able to use updateSQL / rollbackSQL with the Maven plugin to generate the SQL and that seems to work fine.
However, the output does not include any of the metadata information - i.e. there are no creates for the DATABASECHANGELOG table and none of the inserts for that table are included in the generated script.
Is it possible to include the metadata information in the generated SQL?
I'm using Liquibase 3.1.1 (Maven plugin is the same version). I've also tried this from the command line and the behaviour is consistent - i.e. I get the actual changes generated, but not the metadata.
There is not support currently in 3.1.1. It will hopefully be added as a feature in 3.2. https://liquibase.jira.com/browse/CORE-1726.
Are you able to run updateSQL against a backup database that matches production? That will still not execute anything but will include the metadata statements as well. The backup would actually just need the databasechangelog table because that is all liquibase reads unless you are using preconditions.
Running the main method with the option "outputLiquibaseSql=true" as shown here:
liquibase.integration.commandline.Main.main(new String[]{"--changeLogFile=src/test/resources/db.changelog.xml"
,"--outputFile=target/updateSql.txt"
,"--url=offline:unknown?outputLiquibaseSql=true"
, "updateSQL"});
Generates SQL like:
-- *********************************************************************
-- Update Database Script
-- *********************************************************************
-- Change Log: src/test/resources/db.changelog.xml
-- Ran at: 12/04/20 11:51
-- Against: null#offline:unknown?outputLiquibaseSql=true
-- Liquibase version: 3.8.9
-- *********************************************************************
CREATE TABLE DATABASECHANGELOG (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED datetime NOT NULL, ORDEREXECUTED INT NOT NULL, EXECTYPE VARCHAR(10) NOT NULL, MD5SUM VARCHAR(35), DESCRIPTION VARCHAR(255), COMMENTS VARCHAR(255), TAG VARCHAR(255), LIQUIBASE VARCHAR(20), CONTEXTS VARCHAR(255), LABELS VARCHAR(255), DEPLOYMENT_ID VARCHAR(10));
-- Changeset src/test/resources/db.changelog.xml::createTable-example::liquibase-docs
CREATE TABLE public.person (address VARCHAR(255));
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('createTable-example', 'liquibase-docs', 'src/test/resources/db.changelog.xml', CURRENT_TIMESTAMP, 1, '8:49e8eb557129b33d282c4ad2fdc5d4d9', 'createTable tableName=person', '', 'EXECUTED', NULL, NULL, '3.8.9', '6688703163');
As it is running in "offline:unknown" mode it also outputs CSV which are the entries to put into the DATABASECHANGELOG table:
"ID","AUTHOR","FILENAME","DATEEXECUTED","ORDEREXECUTED","EXECTYPE","MD5SUM","DESCRIPTION","COMMENTS","TAG","LIQUIBASE","CONTEXTS","LABELS","DEPLOYMENT_ID"
"createTable-example","liquibase-docs","src/test/resources/db.changelog.xml","2020-04-12T11:51:43.178","2","EXECUTED","8:49e8eb557129b33d282c4ad2fdc5d4d9","createTable tableName=person",,"","3.8.9","()","","6688703163"

Invalid primary key datatype [int]

I am using Afo Castle AR Code Generator v1.0.0.4 at first I was receiving errors for using tinyint as a primary key so I changed those to int but the only error I have left and can't seem to get rid of is
Invalid primary key datatype [int] for
table dbo.Level_Code. Only int
identity and uniqueidentifier primary
keys are supported in the free
version.
The field is already an int in the database. I even tried changing it from an int to tinyint and then back but that still doesn't work.
Any suggestions?
The error message says it only supports an autogenerating int key. Make the int an identity as well and you should be fine.

Tools for Migrating from Oracle to MySQL

I want to migrate schema from Oracle to MySQl, so are there any free tools that would be useful for this task?
I have "Create table" statements in Oracle SQL Script, but it contains unique constraints and a foreign key. MySQL has MyISAM storage engine, and so foreign key is not supported.
How to solve this issue?
Sample Oracle create statements:
CREATE TABLE channels
(
obt_id NUMBER(19) PRIMARY KEY,
discriminator VARCHAR2(64) NOT NULL
CONSTRAINT check_channel_discriminator CHECK (discriminator IN ('CHANNEL','SALES_CHANNEL')),
chan_id VARCHAR2(255),
description VARCHAR2(255),
name VARCHAR2(255) NOT NULL,
obt_version VARCHAR2(255),
fk2_channel NUMBER(19)
CONSTRAINT fk_channel_channel REFERENCES channels(obt_id)
);
CREATE TABLE object_types
(
obt_id NUMBER(19) PRIMARY KEY,
enum_value VARCHAR2(64) NOT NULL,
external_name VARCHAR2(64) NOT NULL,
description VARCHAR2(255),
business_validation NUMBER(1) DEFAULT 0,
start_date_time DATE DEFAULT to_date('01011900','DDMMYYYY'),
end_date_time DATE DEFAULT to_date('01014712','DDMMYYYY'),
mut_date_time DATE DEFAULT SYSDATE,
mut_user VARCHAR2(32) DEFAULT USER,
CONSTRAINT object_types UNIQUE (external_name,start_date_time,end_date_time)
);
I have not heard of a single tool that can assist in what you are asking for. This does not mean one does not exist, however, it is probably easier and less error prone to take your existing Oracle scripts and manually create the appropriate MySQL scripts. On every project I have been on the DBAs were responsible for data migration of this type and they always did it manually.
Edit:
That being said I did a quick google search and there are a few programs that claim to do this (at a cost). For example:
Oracle to MySQL
Data loader
DBConvert
I would obviously caution against using a third party tool and make sure you back up everything before starting.
The mysql gui tool kit includes a migration tool.
http://dev.mysql.com/downloads/gui-tools/5.0.html
You'll need to have the jdbc driver for Oracle installed on the machine where your running the tool kit.