opencart error when upgrade to 2.1.0.1 version - mysqli

I want upgrade from OpenCart version 2.0.3.1 to 2.1.0.1.
I've done an upgrade in the normal way as upgrade process previously. but upgrade this time is different from previous ones. some error show. I've tried several ways in OpenCart forum but did not find a way out
add define('DB_PORT', '3306'); in to the config.php
I created table in my opencart database manually :
CREATE TABLE `oc_cart` (
`cart_id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` int(11) NOT NULL,
`session_id` varchar(32) NOT NULL,
`product_id` int(11) NOT NULL,
`recurring_id` int(11) NOT NULL,
`option` text NOT NULL,
`quantity` int(5) NOT NULL,
`date_added` datetime NOT NULL,
PRIMARY KEY (`cart_id`),
KEY `cart_id` (`customer_id`,`session_id`,`product_id`,`recurring_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
But, I got this error:
Fatal error: Call to undefined method ModelToolOnline::whosonline() in
/home/...................
/modification/catalog/controller/common/footer.php on line 80
So can you help me how to upgrade opencart from 2.0.3.1 version to lastest (2.1.0.1) version without deleting my store data ?
sorry for my bad english :)

Related

How to fix syntax error at or near “CREATE” in psql

please why is this code not working?
nodelogin-# CREATE TABLE user
nodelogin-# (id BIGSERIAL PRIMARY KEY NOT NULL,
nodelogin(# name VARCHAR(200) NOT NULL,
nodelogin(# email VARCHAR(200) NOT NULL,
nodelogin(# password VARCHAR(200) NOT NULL,
nodelogin(# UNIQUE (email));
ERROR: syntax error at or near "CREATE"
LINE 2: CREATE TABLE user
^
user is a reserved key word in PostgreSQL. Basically, PostgreSQL doesn't like the name. If you try a different name (user2, user_, comp_user) it should work

DDL with Index and Hash Partition on Postgres Aurora

Hi i am trying to create a DDL in PostgreSQL Aurora with Hash partition on OBJECT_ID.
Also i want to create a Index on CUSTOMER_ID,OBJECT_TYPE,OBJECT_ID,PT_EVENT_ID
CREATE TABLE event_test(
ID varchar(255) PRIMARY KEY NOT NULL,
VERSION int(11) NOT NULL,
ORDER_TYPE varchar(255) NOT NULL,
EVENT_TYPE varchar(255) NOT NULL,
CUSTOMER_ID varchar(255) DEFAULT NULL,
DETAILS text,
OBJECT_TYPE varchar(255) NOT NULL,
UTC_DATE_TIME date DEFAULT NULL,
EVENT_TO_UTC_DT date DEFAULT NULL,
GROUP_ID varchar(255) DEFAULT NULL,
OBJECT_NAME varchar(2001) DEFAULT NULL,
OBJECT_ID varchar(255) DEFAULT NULL,
USER_NAME varchar(1500) DEFAULT NULL,
USER_ID varchar(255) DEFAULT NULL,
PT_EVENT_ID varchar(255) DEFAULT NULL,
CUSTOM_NOTES varchar(1000) DEFAULT NULL,
SUMMARY varchar(4000) DEFAULT NULL
);
Can some please help me with the DDL .
If all those IDs are in fact UUIDs, the columns should be defined with the uuid type.
The supposedly "magic" limit of 255 does not enable some hidden performance or storage optimizations (at least in Postgres). So blindly using varchar(255) doesn't really make sense (of course if you have a valid business requirement that a value for order_type or event_type may never be longer than 255 characters, then of course keep that constraint.
As documented in the manual there is also no "length" parameter for the integer data type (and it's not a value restriction in MySQL either, so it's pretty much useless to begin with).
So the DDL should be something like this:
CREATE TABLE event_test(
ID uuid PRIMARY KEY NOT NULL,
VERSION integer NOT NULL,
ORDER_TYPE varchar(255) NOT NULL,
EVENT_TYPE varchar(255) NOT NULL,
CUSTOMER_ID uuid DEFAULT NULL,
DETAILS text,
OBJECT_TYPE varchar(255) NOT NULL,
UTC_DATE_TIME date DEFAULT NULL,
EVENT_TO_UTC_DT date DEFAULT NULL,
GROUP_ID uuid DEFAULT NULL,
OBJECT_NAME varchar(2001) DEFAULT NULL,
OBJECT_ID uuid DEFAULT NULL,
USER_NAME varchar(1500) DEFAULT NULL,
USER_ID uuid DEFAULT NULL,
PT_EVENT_ID uuid DEFAULT NULL,
CUSTOM_NOTES varchar(1000) DEFAULT NULL,
SUMMARY varchar(4000) DEFAULT NULL
);
To create an index, you use create index:
create index on event_test (customer_id,object_type,object_id,pt_event_id);
If "most of your access" is through the object_id then you need an index where that is the leading column:
create index on event_test (object_id);
Hash partitioning won't really help you there to make things faster.
You can use partitioning for the table, but this is hardly a performance tool. Due to the limitations of the Postgres partitioning implementation you will also be forced to include the id column in the partitioning key if you want to keep that as the primary key. But given your statement that "most access is through object_id the partitioning key (id, object_id) wouldn't help you at all.

How do I copy information from a text file into a table in my created database in postgresql via pgadmin?

I am working on windows. I have installed postgresql-12 and pgadmin-4 Now through pgadmin I have created a database and through the query tool I have punched in some syntax to create a table within the created database. The syntax is as follows:
CREATE TABLE Calendar (
Date date NOT NULL,
ISO varchar(10) NOT NULL,
datenum int NOT NULL,
DOW char(3) NOT NULL,
DOWint smallint NOT NULL,
Year smallint NOT NULL,
Month smallint NOT NULL,
DOM smallint NOT NULL,
MonthAbbr char(3) NOT NULL,
DOY smallint NOT NULL,
Mondays smallint NOT NULL,
Tuesdays smallint NOT NULL,
Wednesdays smallint NOT NULL,
Thursdays smallint NOT NULL,
Fridays smallint NOT NULL,
Saturdays smallint NOT NULL,
Sundays smallint NOT NULL,
NumHolidays int NOT NULL,
HolidayName varchar(255) NULL,
HolidayType varchar(9) NULL,
hol_National varchar(255) NULL,
hol_Minor varchar(255) NULL,
hol_Christian varchar(255) NULL,
hol_Jewish varchar(255) NULL,
hol_Muslim varchar(255) NULL,
hol_Chinese varchar(255) NULL,
hol_Other varchar(255) NULL
) ;
Now I punch in the following piece of code to fill the created table with data:
COPY Calendar FROM 'C:\Users\LENOVO\SQLbook_database\Calendar.txt'
WITH HEADER NULL 'NULL' DELIMITER ' ' CSV;
When i run the above code it shows me the following message:
ERROR: could not open file "C:\Users\LENOVO\SQLbook_database\Calendar.txt" for reading: Permission denied
HINT: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.
SQL state: 42501
COPY is a server side command. It can only work with files that the user the server runs as has permissions for. For more information see COPY Your choices are to change the file permissions to allow the server user to access it or do as the HINT: says and use psql's \copy command psql.
UPDATE
I don't use pgAdmin much so I forgot, you can also use the Import/Export Dialog in pgAdmin).

Can't create table with text[] data type

I'm trying to store an entity in my postgresql database. This entity has a List in it, so I'd like to use postgresql type TEXT[]. But everytime I'm trying I get a SQL error, I have no idea why.
I don't get the syntax error, really. I'm sure it's a dumb issue but can you help me?
Thank you
I tried some alternatives, creating it directly from h2 console but I always get the same error
The script I use with flyway for creating the table
CREATE TABLE discrimination(
id SERIAL PRIMARY KEY NOT NULL ,
location VARCHAR(255) NOT NULL,
criteria TEXT[] NOT NULL,
domain VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
name_organ VARCHAR(55) NOT NULL,
function_disc VARCHAR(55) NOT NULL
);
my application config for h2 & flyway
h2:
console:
enabled: true
path: /h2
datasource:
url: jdbc:h2:mem:formation-iris;MODE=PostgreSQL
username: test
password: test
driver-class-name: org.h2.Driver
flyway:
locations: classpath:db/migration
enabled: true
And the error I get
Syntax error in SQL statement "CREATE TABLE DISCRIMINATION(
ID SERIAL PRIMARY KEY NOT NULL ,
LOCATION VARCHAR(255) NOT NULL,
CRITERIA TEXT[[*]] NOT NULL,
DOMAIN VARCHAR(255) NOT NULL,
DESCRIPTION TEXT NOT NULL,
NAME_ORGAN VARCHAR(55) NOT NULL,
FUNCTION_DISC VARCHAR(55) NOT NULL
) "; expected "(, FOR, UNSIGNED, INVISIBLE, VISIBLE, NOT, NULL, AS, DEFAULT, GENERATED, ON, NOT, NULL, AUTO_INCREMENT, BIGSERIAL, SERIAL, IDENTITY, NULL_TO_DEFAULT, SEQUENCE, SELECTIVITY, COMMENT, CONSTRAINT, PRIMARY, UNIQUE, NOT, NULL, CHECK, REFERENCES, ,, )"; SQL statement:
From H2 documentation:
Compatibility Modes
For certain features, this database can emulate
the behavior of specific databases. However, only a small subset of
the differences between databases are implemented in this way.
Which means that H2 can emulate certain DB-specific behaviours, but it won't be fully compatible with the selected DB.
That's especially true for SQL syntax.
So, if you want to use arrays in H2, then you should use the H2 syntax ARRAY instead of TEXT[]
Which also means that you will need a separate SQL script for production (PostgreSQL) and for tests (H2). Luckily, flyway supports that. It can load the vendor-specific scripts from different folders. Extend the flyway configuration this way:
spring.flyway.locations=classpath:db/migration/{vendor}
and add the vendor-specific SQL scripts under the /h2 and /postgresql folders respectively.

How to create soap service in zf2?

I have a table named 'Restaurant' with following fields:
CREATE TABLE IF NOT EXISTS `restaurant` (
`restaurant_id` int(11) NOT NULL AUTO_INCREMENT COMMENT,
`restaurant_id_name` varchar(100) NOT NULL COMMENT ,
`restaurant_name` varchar(100) NOT NULL COMMENT,
`restaurant_score` int(10) NOT NULL,
....
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=95 ;
I need to utilize the SOAP server using the ZF2 component Zend\Soap\Server using WSDL for concrete entity/mapper/model(ex Restaurant)(insert/update/delete/retrieve).
Yes I have read the documentation, but I haven't searched for more examples on how to develop a SOAP server in module(Controller\View\Model). If you have any concrete examples or detailed explanations using instances of Zend\Soap\Server and/or Zend\Soap\Client I would be appreciative of reviewing those to help me out.